Chapter 9. The Operating System
67
The system administrator will have the opportunity to customize runlevels by simply adding,
moving, or removing the symbolic links in
/etc/rc
n
.d
if symbolic links are being used, or
by modifying
/etc/runlevel.conf
if the
file rc
method is being used.
To get the default behavior for your package, put in your
postinst
script
update rc.d
package
defaults
and in your
postrm
if [ "$1" = purge ]; then
update rc.d
package
remove
fi
. Note that if your package changes runlevels or priority, you may have to remove and
recreate the links, since otherwise the old links may persist. Refer to the documentation of
update rc.d
.
This will use a default sequence number of 20. If it does not matter when or in which order the
init.d
script is run, use this default. If it does, then you should talk to the maintainer of the
sysvinit
package or post to
debian devel
, and they will help you choose a number.
For more information about using
update rc.d
,
please consult its man page
update rc.d(8)
.
Running initscripts
The program
invoke rc.d
is provided to make it easier for package maintainers to properly
invoke an initscript, obeying runlevel and other locally defined constraints that might limit a
package's right to start, stop and otherwise manage services. This program may be used by
maintainers in their packages' scripts.
The use of
invoke rc.d
to invoke the
/etc/init.d/*
initscripts is strongly recom
mended
1
, instead of calling them directly.
By default,
invoke rc.d
will pass any action requests (start, stop, reload, restart. . . ) to the
/etc/init.d
script, filtering out requests to start or restart a service out of its intended run
levels.
Most packages will simply need to change:
/etc/init.d/
in their
postinst
and
prerm
scripts to:
if which invoke rc.d >/dev/null 2>&1; then
invoke rc.d
package
else
/etc/init.d/
package
fi
1
In the future, the use of invoke rc.d to invoke initscripts shall be made mandatory. Maintainers are advised to
switch to invoke rc.d as soon as possible.
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