Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a script to backup some local directories on a Unix machine (Ubuntu) to a Samba drive. The script works fine and I've got it running at shutdown and restart using the method described at [Ubuntu] Executing a script at startup and shutdown.

It works by placing the backup script into the /etc/rc6.d and /etc/rc0.d directories.

However there is a problem. After looking at the scripts logfile it seems to be run after the user is logged out. We are using LDAP authentication and when the user logs out, the system cannot backup to their Samba share.

Does anyone know of anyway to run the script before the user is logged out?

share|improve this question

The easy way I see this to accomplish is to put the command to call your script to ~/.bash_logout

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.