Last Login: Sun Aug 13 13:59:42 CDT 2017 on tty1
Welcome to Ubuntu 17.04 (GNU/Linux 4.10.0-30-generic x86_64

and so on...

The text above is displayed immediately after login. I would like to run a python script before this text is displayed. The reason is the that script I would like to run is a simple text-based animation and takes up the entire screen. When I run the script from ~/.bashrc or ~/.profile or run the script from a file placed in /etc/profile.d the text above appears on the screen for an instant and then my program is run.

I would like for my program to run and then have the messages above displayed to the screen.

  • 1
    This is not trivial! The information is output by the login program using a number of sources. You can probably create a ~/.hushlogin file to suppress the messages, and a 'fake shell' setting in /etc/login.defs to invoke your program, which could then do whatever you wanted, output the desired information and then invoke the users shell. If the animation is simple enough you might be able to just put it in /etc/motd or maybe /etc/issue. – icarus Aug 13 '17 at 21:08

You need to edit your /etc/motd directory

Here are good examples of how to achieve this

Example 1

Example 2

  • 1
    i do not have a motd directory in /etc but regardless i am not trying to edit the message of the day. I am trying to run a script before any messages are displayed to the user – user246353 Aug 13 '17 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy