Using Local Startup Scripts

One way to modify a system's configuration is to use local startup scripts. The preceding sections described these scripts and their locations. In summary, these scripts are as follows:

Debian All scripts in /etc/rc.boot are local startup scripts. These scripts run after basic system initialization but before SysV startup scripts run. Debian's maintainers discourage use of this directory, and instead recommend creating genuine SysV startup scripts, possibly stored in /etc/rcS.d.

Mandrake, Red Hat, and Slackware The local startup script is /etc/rc.d/rc.local. This script runs after all the SysV startup scripts for Mandrake and Red Hat but before any runlevel-specific scripts in the case of Slackware.

SuSE The local startup script is /etc/init.d/boot.local. This script runs after basic system initialization but before SysV startup scripts run.

One critical difference between distributions is that their local startup scripts run at different times—before or after running the runlevel-specific SysV startup scripts. This fact can have important consequences. For instance, if a SysV startup script starts a server that must have basic networking features active, you can use a local startup script to start networking if your distribution runs the local startup script before the SysV startup scripts. If the local startup script runs after the SysV startup script, though, this may not work or it may require you to restart the server in the local startup script.

In a simple case, you can launch a program via a local startup script by adding the command to the script. For instance, if you've added a server called bigserv to your system by compiling source code, you might add a line like the following to a local startup script in order to launch the server:


Of course, you can add whatever options are appropriate. If the program you call doesn't put itself into the background, the script will stop execution until the program exits, unless you append an ampersand (&) to the command line. A halted startup script will halt the system boot process, so be sure to include this ampersand whenever necessary. Some programs you might call will exit quickly; for instance, the play command will play a sound and then exit, so failure to include the ampersand will delay the boot process only by however long it takes to play the sound file you specify.

0 0

Post a comment