[Pkg-sysvinit-devel] Make init.d/skeleton a very simple init.d script?
pere at hungry.com
Sat Feb 1 23:21:14 UTC 2014
A few month ago I wrote
<URL: http://people.skolelinux.org/pere/blog/Debian_init_d_boot_script_example_for_rsyslog.html >
documenting how at least some init.d script could be made a lot
simpler, removing the need for duplicate code in the simple case with
a forking daemon with pid file support. I did not have time to follow up on the idea until now.
I've just commited the draft into a new branch simpler-init-scripts in
the sysvinit repository, available from
<URL: http://anonscm.debian.org/gitweb/?p=collab-maint/sysvinit;a=shortlog;h=refs/heads/simpler-init-scripts >.
Do you believe we should move forward with this idea? It would reduce
the code needed for most of the around 1000 packages with init.d
scripts, and make sure bugs in a lot of init.d scripts could be fixed
once in the common /lib/init/init-d-script. Based on my flaky memory
and experience transforming Debian to use dependencies for boot
ordering, around 800 of the 1000 packages are simple packages with one
init.d script starting only one daemon.
If a lot of packages start using the feature, it would also make it a
lot easier to separate the "simple" packages from the more complex
ones when migrating to a new boot system in Debian.
The /etc/init.d/skeleton script is changed from several hundred lines
of code to this:
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d. This example start a
# single forking daemon capable of writing a pid
# file. To get other behavoirs, implemend
# do_start(), do_stop() or other functions to
# override the defaults in /lib/init/init-d-script.
### END INIT INFO
# Author: Foo Bar <foobar at baz.org>
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.
DESC="Description of the service"
All the logic is moved to /lib/init/init-d-script, in a way that is
usable by any init.d script.
More information about the Pkg-sysvinit-devel