Execute manuscript prior to closing down
When I shut down my computer system I intend to show some pending jobs that I need to do prior to leaving the workplace ... I did a neighborhood application to take care of those jobs, primarily I simply intend to run a command, and also shut down after I eliminate the application implemented.
If you do ./app-to-run && sudo shutdown -h now
the computer system needs to shut down as soon as application - to - run is done.
Sounds like an inquiry for superuser.com to me. Anyhow, after some Googling I found How to run a script on logout? which claims to add the manuscript to $HOME/. bash_logout.
If that does not function, add
$HOME/.bash_logout
to/ etc/gdm/PostSession/ Default so it implements the logout manuscript effectively.
Viewing as prior to shutdown the customer is turned off anyhow, this need to cover both bases.
You can do this by developing a manuscript in/ etc/rc0. d (for shutdown) and also/ etc/rc6. d (for reboot). To do this, run :
gksu gedit /etc/rc0.d/K01mycustomscript
Edit your shutdown manuscript in the full-screen editor after that run :
sudo chmod +x /etc/rc0.d/K01mycustomscript
And if you desire it to work on reboot additionally after that run this :
sudo cp /etc/rc0.d/K01mycustomscript /etc/rc6.d/K01mycustomscript
Source : this forum thread
Related questions