Sat 30 Sep 2006
encountered that fsck cannot simply repair, the boot process stops, and the system reboots in single-user mode. You then must run fsck manually, and repair the disk problems yourself. When you finish the repairs, exit the single-user shell. The system will then attempt to restart the interrupted boot process from where it left off. The initialization script mounts the /proc filesystem and, after the fsck completes, mounts the root filesystem as read-write. Recall that the root filesystem was initially mounted as read-only. The root must be remounted as read-write before the system can be used. The script also mounts other local filesystems listed in the /etc/fstab file. (The fstab file is described in Chapter 9, “File Sharing.”) The rc.sysinit script finishes up by loading the loadable kernel modules. Other initialization scripts may look different from Red Hat’s, but they perform very similar functions. The order may be different, but the major functions are the same: initialize the swap file, and check and mount the local filesystems. Runlevel Initialization After the system initialization script is run, init runs a script for the specific runlevel. On Red Hat, Mandrake, and Caldera systems, this is done by running a control script and passing it the runlevel number. The control script, /etc/rc.d/rc, then runs all of the scripts that are appropriate for the runlevel. It does this by running the scripts that are stored in the directory /etc/rcn.d, where n is the specified runlevel. For example, if the rc script is passed a 5, it runs the scripts found in the directory /etc/rc.d/rc5.d. A listing of that directory from a Red Hat system shows that there are lots of scripts: Listing 1.5: Runlevel Initialization Scripts $ ls /etc/rc.d init.d rc0.d rc2.d rc4.d rc6.d rc.sysinit rc rc1.d rc3.d rc5.d rc.local $ ls /etc/rc.d/rc3.d K03rhnsd K35smb K74ntpd S05kudzu S25netfs S85httpd K16rarpd K45arpwatch K74ypserv S06reconfig S26apmd S90crond K20nfs K45named K74ypxfrd S08ipchains S28autofs S90xfs K20rstatd K50snmpd K75gated S09isdn S40atd S95anacron K20rusersd K50tux K84bgpd S10network S55sshd S99linuxconf K20rwalld K55routed K84ospf6d S12syslog S56rawdevices S99local K20rwhod K61ldap K84ospfd S13portmap S56xinetd K28amd K65identd K84ripd S14nfslock S60lpd K34yppasswdd K73ypbind K84ripngd S17keytable S80sendmail K35dhcpd K74nscd K85zebra S20random S85gpm The scripts that begin with a K are used to kill processes when exiting a specific runlevel. In Listing 1.5, the K scripts are used when terminating runlevel 5. The scripts that start with an S are used when starting runlevel 5. None of the items in rc5.d, however, is really a startup script. They are logical links to the real scripts, which are located in the /etc/rc.d/init.d directory. For example, S80sendmail is linked to /etc/init.d/sendmail. This raises the question of why the scripts are executed from the directory rc5.d instead of directly from init.d, where they actual reside. The reasons are simple. The same scripts are needed for several different runlevels. Using logical links, the scripts can be stored in one place and still be accessed by every runlevel from the directory used by that runlevel. Additionally, the order in which the scripts are executed is controlled by the script name. The scripts are executed in alphabetical order, based on name. Thus, S10network is executed 30
Note: If you are looking for reliable and quality webspace company to host and run your servlet application check Actions servlet hosting services