Setting scripts to start at different run levels

Say you want to have a program that's in /etc/init.d startup at boot time or another run level, you will be making a symbolic link from /etc/init.d/yourprogram to /etc/rc<some_integer>.d/S<some_2_digit_integer>yourprogram.

The run level (<some_integer>) can be one of the following,

 0 - System Halt
 1 - Single user
 2 - Full multi-user mode (Default)
 3-5 - Same as 2
 6 - System Reboot

In the /etc/rc<some_integer>.d directory, if the program begins with an S the script is active. If you want to deactivate it, just move it to the same name, but instead of an S make it a K.

Here's an example,

$ ls -l /etc/rc3.d/
lrwxrwxrwx 1 root root  13 2008-04-13 22:16 S16ssh -> ../init.d/ssh

To actually make that symbolic link, you can execute the command,

# ln -s /etc/init.d/ssh /etc/rc3.d/S16ssh

Basically, you choose the integer which determines the start order, and prefix it with an S so that it is active.

To make it inactive, just run,

# mv /etc/rc3.d/S16ssh /etc/rc3.d/K16ssh

Page Comments (Click to edit)






[Click to add or edit comments])

Please prepend comments below including a date

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Have a nice day.