I recently got a small server and gave some friends accounts on it. They all have their own web pages in ~/public_html using lighttpd so I wrote a script to backup every user's public_html directory. I have the script in my .profile so it executes every time I log in and then back up the data to my laptop. When the script starts it writes "PROCESSING" to a log file.

I also have a custom bash script in /etc/update-motd.d/ that runs a python script to display when the most recent backup was completed in the MOTD for every user. If the log file says "PROCESSING", however, it should display that instead of the time past since last backup. However, this is not what actually happens. If I ssh in from one terminal and my backup script starts, then ssh in from a second terminal, the MOTD still displays the time since last backup. A cat from the command line in the second shell shows that the log file does indeed contain "PROCESSING".

I then added a timestamp to my last backup script so that the current time is displayed in the MOTD. This led me to discover that the MOTD is not updated while my backup script is running. As soon as my backup script finishes running the timestamp in the MOTD is updated again.

So my question is why would the MOTD fail to update in a second ssh session until a script from my .profile finishes running in the first session?

  • 1
    We can't answer unless you show us the scripts in question. Please edit your question and include the relevant sections (a minimal reproducible example) of the scripts. – terdon Oct 25 '14 at 11:58

Your Answer

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

Browse other questions tagged or ask your own question.