PKGBUILDs/aur/asterisk/asterisk

39 lines
725 B
Text
Raw Normal View History

2011-03-30 00:44:18 +00:00
#!/bin/bash
# general config
. /etc/rc.conf
. /etc/rc.d/functions
PID=`pidof -o %PPID /usr/sbin/asterisk`
case "$1" in
start)
stat_busy "Starting Asterisk"
[ -z "$PID" ] && cd /var/lib/asterisk && /usr/sbin/asterisk -G asterisk -U asterisk
2011-03-30 00:44:18 +00:00
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon asterisk
stat_done
fi
;;
stop)
stat_busy "Stopping Asterisk"
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm -f /var/run/asterisk/asterisk.pid &>/dev/null
rm_daemon asterisk
stat_done
fi
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0