]> git.pld-linux.org Git - packages/asterisk.git/blobdiff - asterisk.init
- http://soft-switch.org/downloads/spandsp/spandsp-0.0.2pre25/asterisk-1.2.x/
[packages/asterisk.git] / asterisk.init
index 8d0f9dfcb6527a0ee5366f56eaf51f6449806ab6..d14d8a9677b6d836453ecbc4dfaff5b01be4de22 100644 (file)
@@ -5,12 +5,12 @@
 #
 # 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
 
 [ -f /etc/sysconfig/asterisk ] && . /etc/sysconfig/asterisk
 
 # Check that networking is up.
-if is_no "${NETWORKING}"; then
-       msg_network_down Asterisk
-       exit 1
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down Asterisk
+               exit 1
+       fi
+else
+       exit 0
 fi
 
 # Sanity check
 [ -f /etc/asterisk/asterisk.conf ] || exit 0
 
+RETVAL=0
 # See how we were called.
 case "$1" in
   start)
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/asterisk ]; then
                msg_starting Asterisk
-               busy            
                daemon $SERVICE_RUN_NICE_LEVEL asterisk $ASTERISK_OPTS
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
@@ -55,32 +59,33 @@ case "$1" in
                rm -f /var/lock/subsys/asterisk >/dev/null 2>&1
        else
                msg_not_running Asterisk
-               exit 1
        fi
        ;;
-  restart)
+  restart|force-reload)
        $0 stop
        $0 start
+       exit $?
        ;;
   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
-       ;;
+       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
+       ;;
   status)
        status asterisk
        exit $?
        ;;
   *)
-       msg_usage "$0 {start|stop|status|restart|reload}"
-       exit 1
+       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       exit 3
 esac
 
 exit $RETVAL
This page took 0.063679 seconds and 4 git commands to generate.