1234567891011121314151617181920212223242526272829303132333435363738 |
- #!/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' 2>/dev/null`
- 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"
- }
|