Looking to automate some commands to run at boot and poweroff in a startup/shutdown script.
How do I place it on the system so that it will be run automatically?
I don't want to use cron, not quite specific enough, random times when I may boot or shutdown.
---------- Post updated at 10:47 PM ---------- Previous update was at 10:07 PM ----------
Solved, halfway, someone who posted a solution and then took it down (??).
Can run stuff on startup, just looking for the shutdown equivalent.
man 5 crontab
Code:
---------
string meaning
------ ------- @reboot Run once, at startup. @yearly Run once a year, "0 0 1 1 *". @annually (same as @yearly) @monthly Run once a month, "0 0 1 * *". @weekly Run once a week, "0 0 * * 0". @daily Run once a day, "0 0 * * *". @midnight (same as @daily) @hourly Run once an hour, "0 * * * *".
---------
Ah right, I did wonder lol.
Yeah I didn't realise cron had that option, so that's good for the startup section that I need, just need to get an equivalent for shutdown.
Ubuntu 10.4 32-bit
---------- Post updated at 11:22 PM ---------- Previous update was at 10:55 PM ----------
That would be the place to put it. Runlevel 0 is entered when halting the system.
The script would typically go into /etc/init.d, and have a link in /etc/rc.d/rc0.d and /etc/rc.d/rc3.d as Knn and Snn for Kill and Start, where nn is a number that determines the sequence during startup / shutdown the script is run.