res_pjsip_log_forwarder.c: Add CLI "pjsip show buildopts".
[asterisk/asterisk.git] / contrib / init.d / rc.debian.asterisk
index 69d6c17..211737f 100755 (executable)
@@ -66,10 +66,10 @@ case "$1" in
   start)
        # Check if Asterisk is already running.  If it is, then bug out, because
        # starting up Asterisk when Asterisk is already running is very bad.
-       VERSION=`${DAEMON} -rnx 'core show version' || ${TRUE}`
+       VERSION=`${DAEMON} -rx 'core show version' 2>/dev/null || ${TRUE}`
        if [ "`echo $VERSION | cut -c 1-8`" = "Asterisk" ]; then
                echo "Asterisk is already running.  $0 will exit now."
-               exit 1
+               exit 0
        fi
 
        log_begin_msg "Starting $DESC: $NAME"
@@ -132,9 +132,12 @@ case "$1" in
        $0 start
        # "restart|force-reload" starts Asterisk and returns 0 even if Asterisk was stopped (as LSB expects).
        ;;
+  status)
+       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+       ;;
   *)
        N=/etc/init.d/$NAME
-       echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+       echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
        exit 1
        ;;
 esac