forked from jengelh/asterisk
45 lines
1.1 KiB
Bash
45 lines
1.1 KiB
Bash
#!/bin/sh
|
|
### 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: 3 5
|
|
# Default-Stop: 0 1 2 6
|
|
# Short-Description: Asterisk PBX
|
|
# Description: the Asterisk Open Source PBX
|
|
### END INIT INFO
|
|
. /etc/rc.status
|
|
pid="/var/run/asterisk/asterisk.pid";
|
|
dmn="/usr/sbin/asterisk";
|
|
case "$1" in
|
|
start)
|
|
echo -en "Starting asterisk ";
|
|
startproc -sp "$pid" "$dmn" -fn;
|
|
rc_status -v;;
|
|
stop)
|
|
echo -en "Stopping asterisk ";
|
|
killproc -p "$pid" "$dmn";
|
|
rc_status -v;;
|
|
status)
|
|
echo -en "Checking for asterisk ";
|
|
checkproc -p "$pid" "$dmn";
|
|
rc_status -v;;
|
|
reload)
|
|
echo -en "Reloading asterisk ";
|
|
killproc -p "$pid" -HUP "$dmn";
|
|
rc_status -v;;
|
|
restart)
|
|
"$0" stop;
|
|
"$0" start;
|
|
rc_status;;
|
|
try-restart)
|
|
"$0" status >/dev/null && "$0" restart;
|
|
rc_status;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|status|reload|restart|try-restart}";
|
|
exit 1;;
|
|
esac;
|
|
rc_exit;
|