INIT ( Startup Scripts )
The boot process of a Linux distro is a complex process, and today we will shed some light on a small part of it: The init-scripts.
Let's say you have a program you want to start at boot, depending on the runlevel ( See Runlevels
). Here are two ways to get the job done:
1). The first way is you add the command to start your program at the end of the "rc.local" file. Here is a list of the location of that file in the major distros:
2). Or, if starting the program takes more than one line, make a simple bash-script ( See Bash Script
), make it executable and place the script in the /etc/init.d directory.
The next step is to decide what Runlevel
you want the script to be executed, the runlevels are represented by directories you will find in /etc/rc.d they are numbered rc1.d, to rc6.d ( in Debian and Ubuntu see the "README" in the /etc/rcS.d directory ) . . . . you might want to have a look in one of them:
This way you are sure it will start at the end of the bootup in runlevel 5 . . . . . ( make sure the /etc/init.d/clocksync is executable or it will not work ! )
If you then discover the "clocksync" program starts too late, you simply remove the link and make a new one with a lower "S" number
PS: More about the Linux boot process: http://bobcares.com/article18.html
-- Apr 24 2006 ( Revised Jul 22 2006 ) --