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.

2019-05-06 22:39:46
Source Share
Answers: 4

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.

2019-05-08 19:23:32

You can add your command to the documents /etc/gdm/PostSession/Default prior to the exit 0 line.

2019-05-08 19:22:41

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


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.

2019-05-08 19:20:33

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

2019-05-08 19:02:34