]> git.pld-linux.org Git - packages/asterisk.git/blobdiff - asterisk.init
- up to 1.4.26.2
[packages/asterisk.git] / asterisk.init
index 255cfcff45bc43b1d4f4487a723b23e0678d04fc..cc1aab8f01a3375b9c307d7d3200aa468cedcb92 100644 (file)
@@ -5,16 +5,19 @@
 #
 # chkconfig:   345 90 25
 #
-# description: Asterisk is an Open Source PBX and telephony development platform that
-#              can both replace a conventional PBX and act as a platform for
-#              developing custom telephony applications for delivering dynamic
-#              content over a telephone similarly to how one can deliver dynamic
+# description: Asterisk is an Open Source PBX and telephony development platform that \ \
+#              can both replace a conventional PBX and act as a platform for \
+#              developing custom telephony applications for delivering dynamic \
+#              content over a telephone similarly to how one can deliver dynamic \
 #              content through a web browser using CGI and a web server.
-#              
+#
 # pidfile:     /var/run/asterisk.pid
 # config:      /etc/asterisk/asterisk.conf
 
 
+# Sanity check
+[ -f /etc/asterisk/asterisk.conf ] || exit 0
+
 # Source function library
 . /etc/rc.d/init.d/functions
 
@@ -26,7 +29,7 @@
 
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
-       if [ ! -f /var/lock/subsys/network -a != stop -a != status ]; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
                msg_network_down Asterisk
                exit 1
        fi
@@ -34,13 +37,7 @@ else
        exit 0
 fi
 
-# Sanity check
-[ -f /etc/asterisk/asterisk.conf ] || exit 0
-
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/asterisk ]; then
                msg_starting Asterisk
@@ -50,8 +47,9 @@ case "$1" in
        else
                msg_already_running Asterisk
        fi
-       ;;
-  stop)
+}
+
+stop() {
        # Stop daemons.
        if [ -f /var/lock/subsys/asterisk ]; then
                msg_stopping Asterisk
@@ -60,24 +58,37 @@ case "$1" in
        else
                msg_not_running Asterisk
        fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+       stop
+       start
+       ;;
+  reload)
+       if [ -f /var/lock/subsys/asterisk ]; then
+               msg_reloading Asterisk
+               busy
+               asterisk -rx reload > /dev/null 2>&1
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
+               ok
+       else
+               msg_not_running Asterisk
+               exit 1
+       fi
        ;;
-#  reload)
-       # Should be some better way...
-#      $0 restart
-#      if [ -f /var/lock/subsys/ ]; then
-#              msg_reloading Asterisk
-#              busy
-#              ok
-#      else
-#              msg_not_running Asterisk
-#              exit 1
-#      fi
-#      ;;
+  logger-reload)
+        asterisk -rx 'logger reload'
+        ;;
   status)
        status asterisk
        exit $?
This page took 0.120707 seconds and 4 git commands to generate.