Synapse ↵

logically incoherent… not!

Archive for March, 2007

Run a script on Startup / Shutdown in Linux

Posted by synapse on March 24, 2007

Hi all, Been a long time! I’ll try to be more regular from now on. Here’s a simple post on how to add a script to your system startup or shutdown

Write a script. Lets call it foo.sh

Now, to start the script on startup -

update-rc.d -f foo.sh start 99 2 3 4 5 .

where
- start is the argument given to the script (start, stop).
- 99 is the start order of the script (1 = first one, 99= last one)
- 2 3 4 5 are the runlevels to start

Dont forget the dot at the end

Start my_script on shutdown and reboot :

# update-rc.d -f foo.sh start 90 0 6 .

Stop my_script on halt and reboot :

# update-rc.d -f foo.sh reboot 90 0 6 .

That’s all. Have fun!

Posted in Links, Tips and Tricks | 2 Comments »