updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / asterisk10 / asterisk
blobf823caefceae21e7b72cae71c9f04ed93b3bbfeb
1 #!/bin/bash
3 # general config
4 . /etc/rc.conf
5 . /etc/rc.d/functions
7 PID=`pidof -o %PPID /usr/sbin/asterisk`
8 case "$1" in
9 start)
10 stat_busy "Starting Asterisk"
11 [ -z "$PID" ] && cd /var/lib/asterisk && /usr/sbin/asterisk -G asterisk -U asterisk
12 if [ $? -gt 0 ]; then
13 stat_fail
14 else
15 add_daemon asterisk
16 stat_done
19 stop)
20 stat_busy "Stopping Asterisk"
21 [ ! -z "$PID" ] && kill $PID &> /dev/null
22 if [ $? -gt 0 ]; then
23 stat_fail
24 else
25 rm -f /var/run/asterisk/asterisk.pid &>/dev/null
26 rm_daemon asterisk
27 stat_done
30 restart)
31 $0 stop
32 sleep 2
33 $0 start
36 echo "usage: $0 {start|stop|restart}"
37 esac
38 exit 0