How to run a command before the machine automatically shutdowns?
|
|
How about to put a script in the correct runlevel? I think runlevel 6 is shutdown, and then the dir to play in is /etc/rc6.d/ |
|||
|
|
|||||||||
|
|
Try this one, replacing Before you do anything, make sure there is a line like
in
|
||||
|
|
|
As a simplified version of funicorn's answer.. an upstart job, either in /etc/init/foo.conf or as ~/.init/foo.conf :
This will run, and block the entire shutdown until "myscript" exits. That is all you need. Note that the user jobs (~/.init/foo.conf) are a very new feature and on my 12.04 system with ecryptfs /home do not work, so you may just have to put the job in /etc/init. |
|||
|
|
