aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-18 21:01:46 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-18 21:01:46 +0000
commitfd973179a616e6ac96350ae1449d8057e8f3f142 (patch)
tree6e1308a46f87817ca3acca2e8adab202092a4c05 /contrib
parent58b7f09f59975573acc6cb8348843885b5fd040b (diff)
Add init script for ArchLinux
(closes issue #13667) Reported by: sherif Patches: archlinux_rc_makefile.patch uploaded by sherif (license 591) archlinux_rc_makefile-2.patch uploaded by mvanbaak (license 7) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@157460 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'contrib')
-rw-r--r--contrib/init.d/rc.archlinux.asterisk46
1 files changed, 46 insertions, 0 deletions
diff --git a/contrib/init.d/rc.archlinux.asterisk b/contrib/init.d/rc.archlinux.asterisk
new file mode 100644
index 000000000..a4b7c633c
--- /dev/null
+++ b/contrib/init.d/rc.archlinux.asterisk
@@ -0,0 +1,46 @@
+#!/bin/bash
+#
+# Start/stop/restart Asterisk PBX
+#
+# Version: 0.1 by Sherif Nagy AKA DarKnesS_WolF <sherif.nagy@gmail.com> BASED ON THE SLACKWARE INIT SCRIPT
+#
+# 10.10.2008 - Initial Version
+#
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting Asterisk..."
+ if [ -x /usr/sbin/asterisk ]; then
+ # Check if Asterisk is already running. If it is, then bug out, because
+ # starting safe_asterisk when Asterisk is running is very bad.
+ VERSION=`/usr/sbin/asterisk -rx 'core show version'`
+ if [ "`echo $VERSION | cut -c 1-8`" = "Asterisk" ]; then
+ echo "Asterisk is already running. $0 will exit now."
+ exit 1
+ fi
+ /usr/sbin/asterisk
+ stat_done
+ fi
+ ;;
+ stop)
+ if [ -r /var/run/asterisk.pid ]; then
+ stat_busy "Stoping Asterisk..."
+ asterisk -rx "core stop now" > /dev/null 2&>1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage $0 start|stop|restart" ;;
+esac
+exit 0