Chapter 9. The Operating System
68
A package should register its initscript services using
update rc.d
before it tries to invoke
them using
invoke rc.d
. Invocation of unregistered services may fail.
For more information about using
invoke rc.d
,
please consult its man page
invoke rc.d(8)
.
9.3.4 Boot time initialization
There used to be another directory,
/etc/rc.boot
, which contained scripts which were run
once per machine boot. This has been deprecated in favour of links from
/etc/rcS.d
to files
in
/etc/init.d
as described in `Introduction' on page
64
. Packages must not place files in
/etc/rc.boot
.
9.3.5 Example
The
bind
DNS (name server) package wants to make sure that the name server is running
in multiuser runlevels, and is properly shut down with the system. It puts a script in
/etc
/init.d
, naming the script appropriately
bind
. As you can see, the script interprets the
argument
reload
to send the name server a
HUP
signal (causing it to reload its configuration);
this way the system administrator can say
/etc/init.d/bind reload
to reload the name
server. The script has one configurable value, which can be used to pass parameters to the
named program at startup; this value is read from
/etc/default/bind
(see below).
#!/bin/sh
#
# Original version by Robert Leslie
# , edited by iwj and cs
test x /usr/sbin/named || exit 0
# Source defaults file.
PARAMS=''
if [ f /etc/default/bind ]; then
. /etc/default/bind
fi
case "$1" in
start)
echo n "Starting domain name service: named"
start stop daemon start quiet exec /usr/sbin/named \
$PARAMS
echo "."
;;
stop)
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved