summaryrefslogtreecommitdiff
path: root/social/asterisk/asterisk
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2011-10-23 04:57:38 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2011-10-23 04:57:38 -0300
commitdb83c17ba25c263db80a7999254a255b14ef0e37 (patch)
tree8825488946334cc194a8490ad7944218fe3896a9 /social/asterisk/asterisk
parent128fec48de2a334c7af257ce0efe3315e5055ba6 (diff)
social/{asterisk,dropbear,openswan,poco,sipwitch,spectrum,ucommon}
Diffstat (limited to 'social/asterisk/asterisk')
-rw-r--r--social/asterisk/asterisk38
1 files changed, 38 insertions, 0 deletions
diff --git a/social/asterisk/asterisk b/social/asterisk/asterisk
new file mode 100644
index 000000000..f823caefc
--- /dev/null
+++ b/social/asterisk/asterisk
@@ -0,0 +1,38 @@
+#!/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
+ 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