about a specific number, but some services need to be running before others
are started. You would not want your Ubuntu system to attempt, for example,
to mount a remote Network File System (NFS) volume without first starting
networking and NFS services.
Understanding init Scripts and the Final Stage of
Initialization
Each /etc/init.d script, or init script, contains logic that determines
what to do when receiving a start or stop value. The logic might be a
simple switch statement for execution, as in this example:
Click here to view code image
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
status)
rhstatus
;;
condrestart)
[ -f /var/lock/subsys/smb ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|restart|status|condrestart}"
exit 1
esac
Although you can use scripts to customize the way that the system runs from
power-on, absent the replacement of the kernel, this script approach also
means you do not have to halt the system in total to start, stop, upgrade, or
install new services.
Note that not all scripts use this approach and that other messages might be
passed to the service script, such as restart, reload, or status
messages. Also, not all scripts respond to the same set of messages (with the
exception of start and stop, which they all have to accept by convention)