|< Day Day Up >|
Init is a process started by the kernel during the boot, and it takes over the control of the start sequence. The main configuration file is /etc/inittab. In this file we can provide the default runlevel. The default runlevel for systems with graphical login is 5 without 3.
The first script started by init is /etc/init.d/boot, after it runs all startscripts in /etc/init.d/rc3.d (or rc5.d, for runlevel 5). If you want to add something to be run before the runlevel scripts, add it to /etc/init.d/boot.local.
If you need to add something in runlevel 3 or runlevel 5, then place your script in /etc/init.d and place a link starting with S+number and K+number in /etc/initrd/rc5.d.
On SuSE SLES8, use /etc/init.d/skeleton as a template if you need to create your own start/stop scripts.
The /etc/init.d directory contains all start and stop scripts for all runlevels. Each runlevel has its own subdirectory containing symbolic links to the scripts in /etc/init.d. These are located under /etc/init.d/rcX.d (X stands for runlevel number 1-6).
These directories contain links beginning with the letter S, to be executed with the start option when the system enters the runlevel. Links to scripts beginning with the letter K are going to be executed when the system is leaving the runlevel, and only if the new runlevel does not contain the same script.
The number determines the execution order. For example, the symbolic link in /etc/init.d/rc3.d named S09sshd will be executed when entering runlevel3 after S05network; in fact, /etc/init.d/ssh will be called with the "start" option.
The runlevel description is given in /etc/inittab and is defined through the Linux Standard base specification: 
We wondered why SuSE asked us for the root password even when booting in single user mode (init 1). The answer is contained in the following entry in the /etc/inittab file, asking what to do in single-user mode:
# what to do in single-user mode ls:S:wait:/etc/init.d/rc S ~~:S:respawn:/sbin/sulogin
Both SuSE and Red Hat distributions provide a chkconfig script that allows us to manipulate and display the runlevel links. The chkconfig script relies on two comment lines in the start/stop scripts; for example, in Red Hat:
# chkconfig: 2345 20 80 # description: Saves and restores system entropy pool
SuSE  has a different format:
# Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: Apache httpd
chkconfig --list will display all services and show in which runlevels these will be started.
We can easily change it by issuing following commands:
chkconfig apache on on SuSE, or chkconfig httpd on on Red Hat, will enable us to start Apache in the default runlevels defined in the /etc/init.d/apache script.
chkconfig --list apache will show the changes we have made. Be aware, however, that chkconfig does not start or stop the services; it simply sets them to be started or not started when entering the runlevel. 
|< Day Day Up >|