res_pjsip_log_forwarder.c: Add CLI "pjsip show buildopts".
[asterisk/asterisk.git] / contrib / init.d / rc.mandriva.asterisk
index daea071..e095ccf 100755 (executable)
 # processname: asterisk
 # 
 
+### BEGIN INIT INFO
+# Provides:            asterisk
+# Required-Start:    $network $syslog $named $local_fs $remote_fs
+# Required-Stop:     $network $syslog $named $local_fs $remote_fs
+# Should-Start:      dahdi misdn lcr wanrouter mysql postgresql
+# Should-Stop:       dahdi misdn lcr wanrouter mysql postgresql
+# Default-Start:       2 3 4 5
+# Default-Stop:                0 1 6
+# Short-Description:   Asterisk PBX
+# Description:         the Asterisk Open Source PBX
+### END INIT INFO
+
 # $Id$
 
 TTY=9                  # TTY (if you want one) for Asterisk to run on
@@ -37,7 +49,7 @@ else
 fi
 
 # Put overrides in /etc/sysconfig/asterisk
-[ -f $CONFIGFILE ] && . $CONFIGFILE
+[ -r $CONFIGFILE ] && . $CONFIGFILE
 
 LD_LIBRARY_PATH=$OPENH323DIR/lib:$PWLIBDIR/lib
 export OPENH323DIR PWLIBDIR LD_LIBRARY_PATH
@@ -123,7 +135,7 @@ case "$1" in
        start)
                # Check if Asterisk is already running.  If it is, then bug out, because
                # starting Asterisk when Asterisk is already running is very bad.
-               VERSION=`${ASTSBINDIR}/asterisk -rx 'core show version'`
+               VERSION=`${ASTSBINDIR}/asterisk -rx 'core show version' 2>/dev/null`
                if [ "`echo $VERSION | cut -c 1-8`" = "Asterisk" ]; then
                        echo "Asterisk is already running.  $0 will exit now."
                        exit 1
@@ -142,7 +154,7 @@ case "$1" in
                ;;
        stop)
                gprintf "Stopping asterisk: "
-               asterisk -r -x "stop gracefully" >/dev/null 2>&1
+               asterisk -r -x "core stop gracefully" >/dev/null 2>&1
                killall -9 mpg123 2>/dev/null
                success
                echo
@@ -154,13 +166,13 @@ case "$1" in
                ;;
        reload)
                gprintf "Reloading asterisk: "
-               asterisk -r -x "reload" >/dev/null 2>&1
+               asterisk -r -x "module reload" >/dev/null 2>&1
                success
                echo
                ;;
        stopnow)
                gprintf "Stopping asterisk: "
-               asterisk -r -x "stop now" >/dev/null 2>&1
+               asterisk -r -x "core stop now" >/dev/null 2>&1
                success
                echo
                ;;