[asterisk-bugs] [Asterisk 0014864]: [patch] LSB header for init scripts
Asterisk Bug Tracker
noreply at bugs.digium.com
Sat Dec 19 07:12:33 CST 2009
A NOTE has been added to this issue.
======================================================================
https://issues.asterisk.org/view.php?id=14864
======================================================================
Reported By: lathama
Assigned To:
======================================================================
Project: Asterisk
Issue ID: 14864
Category: Core/BuildSystem
Reproducibility: always
Severity: text
Priority: normal
Status: feedback
Asterisk Version: 1.6.0.7
JIRA: SWP-492
Regression: No
Reviewboard Link:
SVN Branch (only for SVN checkouts, not tarball releases): 1.6.1
SVN Revision (number only!):
Request Review:
======================================================================
Date Submitted: 2009-04-08 15:47 CDT
Last Modified: 2009-12-19 07:12 CST
======================================================================
Summary: [patch] LSB header for init scripts
Description:
Add LSB headers to init scripts.
Suggestion
### BEGIN INIT INFO
# Provides: asterisk
# Required-Start: $network $local_fs $syslog
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start Asterisk at boot time
# Description: Asterisk a software PBX and VoIP glue.
### END INIT INFO
For all platforms.
http://wiki.debian.org/LSBInitScripts
eg.. asterisk/contrib/init.d/rc.debian.asterisk
======================================================================
----------------------------------------------------------------------
(0115459) pkempgen (reporter) - 2009-12-19 07:12
https://issues.asterisk.org/view.php?id=14864#c115459
----------------------------------------------------------------------
Patch (lsb-init-info-debian.diff, against trunk r.235773) attached.
Explanation:
I have moved the whole INIT INFO block further to the top since I
think that many implementations look for it in the first 25 lines or
something.
---cut---
# Provides: asterisk
---cut---
"facilities provided by this init script." Pretty self-explanatory.
---cut---
# Required-Start: $network $syslog $named $local_fs $remote_fs
# Required-Stop: $network $syslog $named $local_fs $remote_fs
---cut---
"facilities which must be available during startup (resp. shutdown)
of this service"
These are standard LSB facility names.
http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/facilname.html
I have added $remote_fs since Asterisk depends on files in the /usr
hierarchy and /usr might be a remote file system.
The Debian wiki says "Scripts depending on $remote_fs do not need
to depend on $local_fs." so we could remove the dependency on
$local_fs. However the LSB standard does not mention this exception
and it doesn't hurt to depend on $local_fs thus it stays.
$network means "basic networking support is available. Example: a
server program could listen on a socket."
$named means "IP name-to-address translation ... Example: if a DNS
query daemon normally provides this facility, then that daemon has
been started."
$syslog means "system logger is operational."
---cut---
# Should-Start: dahdi misdn lcr wanrouter mysql postgresql
# Should-Stop: dahdi misdn lcr wanrouter mysql postgresql
---cut---
"facilities which, if present, should be available during startup
(resp. shutdown) of this service. This allows for weak dependencies
which do not cause the service to fail if a facility is not
available."
Example: If (and only if) dahdi is present on the system then dahdi
should be started before asterisk. The same thing goes for other
ISDN/analog card drivers: misdn, lcr (Linux Call Router), wanpipe/
wanrouter.
I have added mysql and postgresql since asterisk might be configured
to read from or write to a database (Realtime, CDRs) and so the
database (if present) should already be running when asterisk is
started.
---cut---
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
---cut---
"which run levels should by default run the init script with a start
(stop) argument to start (stop) the services controlled by the init
script."
On Debian daemons usually start when switching to runlevels 2, 3, 4
or 5 (multiuser modes) and stop at 1 (single-user mode), 0 (halt),
6 (reboot).
http://wiki.debian.org/RunLevel
Other distributions might have slightly different conventions.
http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/runlevels.html
References:
http://wiki.debian.org/LSBInitScripts
http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/tocsysinit.html
Basically the same INIT INFO block could be used for all
contrib/init.d/rc.*.asterisk init scripts.
However different distros might have different conventions for
runlevels and as Tzafrir pointed out names of services (in
Should-Start/Should-Stop) differ a bit between distributions.
I guess though that starting at runlevel 2 3 4 5 and stopping at
0 1 6 should be sane and since we list only standard LSB facilities
in Required-Start/Required-Stop the same INIT INFO block should work
on all distros. Names of services listed in Should-Start/Should-Stop
might differ between distributions but since these are "weak
dependencies which do not cause the service to fail if a facility is
not available" they shouldn't do any harm.
I cannot comment on other distros though so my patch is for Debian
only.
Issue History
Date Modified Username Field Change
======================================================================
2009-12-19 07:12 pkempgen Note Added: 0115459
======================================================================
More information about the asterisk-bugs
mailing list