Run script when shutting down ubuntu before the logged in user is logged out

Posted by Travis on Super User See other posts from Super User or by Travis
Published on 2012-10-26T10:01:46Z Indexed on 2012/10/26 11:04 UTC
Read the original article Hit count: 303

Filed under:
|
|
|
|

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 http://en.kioskea.net/faq/3348-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?

© Super User or respective owner

Related posts about unix

Related posts about backup