asterisk/contrib/init.d/rc.gentoo.asterisk
Tilghman Lesher dd0ab33cb2 Add LSB headers to init scripts.
(closes issue #14864)
 Reported by: lathama
 Patches: 
       lsb-init-info-debian.diff uploaded by pkempgen (license 169)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239270 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-11 23:53:32 +00:00

39 lines
1 KiB
Text
Executable file

#!/sbin/runscript
# $Id$
### BEGIN INIT INFO
# Provides: asterisk
# Required-Start: $network $syslog $named $local_fs $remote_fs
# Required-Stop: $network $syslog $named $local_fs $remote_fs
# Should-Start: dahdi misdn lcr wanrouter mysql postgresql
# Should-Stop: dahdi misdn lcr wanrouter mysql postgresql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Asterisk PBX
# Description: the Asterisk Open Source PBX
### END INIT INFO
depend() {
need net logger
}
start() {
# Check if Asterisk is already running. If it is, then bug out, because
# starting safe_asterisk when Asterisk is running is very bad.
VERSION=`${ASTSBINDIR}/asterisk -rx 'core show version'`
if [ "`echo $VERSION | cut -c 1-8`" = "Asterisk" ]; then
echo "Asterisk is already running. $0 will exit now."
exit 1
fi
ebegin "Starting Asterisk"
/usr/sbin/asterisk
eend $? "Failed to start Asterisk"
}
stop() {
ebegin "Stopping Asterisk"
kill $(cat /var/run/asterisk.pid)
eend $? "Failed to stop Asterisk"
}