|
|
System states 0, 1, 2, and 3 each have a directory of files that are executed in transitions to and from that state. These directories are /etc/rc0.d, /etc/rc1.d, /etc/rc2.d, and /etc/rc3.d, respectively. States 2 and 3 also execute files in the /etc/dinit.d directory. Most files in these directories are linked to files in the /etc/init.d directory. Typically, their purpose is to start and stop various system services or daemons.
The system state files in /etc/dinit.d are named according to the following conventions:
SNNnameEach filename consists of three parts:or
KNNname
The /etc/init.d/lp shell script is linked to the /etc/dinit.d/S80lp and /etc/rc0.d/K20lp files. When run with the start option, the /etc/init.d/lp script executes /usr/lib/lpsched to start the printing scheduler. When run with the stop option, it executes /usr/lib/lpshut to kill the printing scheduler.
When you run
init 2,
init
runs the scripts in
/etc/dinit.d,
one of which is
S80lp.
The script
S80lp
is executed with the
start
option, as follows:
sh S80lp start
Similarly, when you run
init 0,
/etc/rc0.d/K20lp
is executed with the
stop
option:
sh K20lp stop
Running either of these scripts is the same as running /etc/init.d/lp with the appropriate start or stop option.
Because system state files are shell scripts, you can read them to see what they do. You can also change the files, although it is preferable to create your own versions because the delivered scripts may change in future releases.
Follow these rules when creating your own scripts: