312 Part II . Getting Around in Linux Off of the root of the tree is a directory named init.d. Inside this directory are many different script files. Each of these scripts serves a specific purpose, whether it is to start a server, bring up the networking subsystem, or check files. These scripts can be used to manage the services on the system. To see which commands can be passed to a script, just execute the script with no parameters. For example: [root@redhat init.d]# ./lpd Usage: lpd {start|stop|restart|reload|status} Cross-The startup scripts are covered in more detail in Chapter 11. Reference All scripts will take the start, stop, and restart commands at a minimum. These are used to gracefully manage the service and should be used instead of running the service executable manually. Many services provide the status command, which can show useful information, such as the following: [root@redhat init.d]# ./network status Configured devices: lo eth0 Devices that are down: Devices with modified configuration: Off /etc or /etc/rc.d are directories for each runlevel named rc0.d through rc6.d. Inside the runlevel directories are link files to the scripts contained in the init.d directory. The names of the link files in the runlevel directories are not the same as the script they link to. The first letter is either an S or a K. When the system executes the scripts in the runlevel directory, it passes the start command to the scripts starting with S, and passes the stopcommand to scripts starting with K. This way you can limit which processes stay running when changing runlevels. After the first letter is a number that specifies the order the scripts are started. This way you can say that S30Syslog starts before S50inet. After the priority number is a name for the script, which is just descriptive information. Since the runlevel directories contain only links to the scripts in init.d, it is very easy to change the services and functions that happen when a new runlevel is entered. If you want to remove a service, just delete the link file. If you want to add a new service to a runlevel, you just make a symbolic link to the script file in init.d, with an S as the first letter and a priority number. Also, since all the run- levels point to the same scripts, you need to make modifications to only one file to make a change. Red Hat startup When Red Hat starts up, the first script run by init is the /etc/rc.d/rc.sysinit. It is run by the following line in the /etc/inittab file. si::sysinit:/etc/rc.d/rc.sysinit
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.