I would like to run a script file when the system is called for shutdown/ reboot from 'reboot' and 'shutdown' commands. And if possible, also hard shutdowns like 'init 0' or 'poweroff'. How would I go about doing that? A config file or command would be nice. I use systemd
instead of initscripts
.
Add a comment
|
1 Answer
Just copy / link the script into your /etc/init.d/rc0.d (HALT) and /etc/init.d/rc6.d (reboot) directories, and make sure it's name is prefixed with: "K20"
-
I use systemd instead of initscripts. Know a different way to do that without using initscripts? Sorry that wasnt in my post– WolfizenCommented Jan 18, 2013 at 16:42
-
1The How Do I Convert A SysV Init Script Into A systemd Service File? page explains the basics, just add the appropriate WantedBy= targets to your service file e.g. [Install] WantedBy=final.target / halt.target / shutdown.target– arober11Commented Jan 19, 2013 at 7:18
-