Package: stun
Version: 0.96.dfsg-5
Severity: normal
Tags: patch
Hi,
/etc/init.d/stun is missing the 'status' option.
I've attached a patch to support this function.
BR
Björn
--- stun 2007-11-02 07:35:04.000000000 +0100
+++ stun-new 2008-08-06 11:21:32.000000000 +0200
@@ -27,6 +27,7 @@
NAME=stun
DESC=stun
START_DAEMON=false
+PIDFILE=/var/run/$NAME.pid
test -x $DAEMON || exit 0
@@ -65,13 +66,13 @@
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --background --make-pidfile \
- --pidfile /var/run/$NAME.pid \
+ --pidfile $PIDFILE \
--chuid $DAEMON_USER --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
- start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--chuid $DAEMON_USER --exec $DAEMON
echo "$NAME."
;;
@@ -85,7 +86,7 @@
#
# echo "Reloading $DESC configuration files."
# start-stop-daemon --stop --signal 1 --quiet --pidfile \
- # /var/run/$NAME.pid --exec $DAEMON
+ # $PIDFILE --exec $DAEMON
#;;
restart|force-reload)
#
@@ -95,16 +96,32 @@
#
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile \
- /var/run/$NAME.pid --exec $DAEMON
+ $PIDFILE --exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --pidfile \
- /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
+ $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
+ status)
+ echo -n "Status of $DESC: "
+
+ if [ ! -r "$PIDFILE" ]; then
+ echo "$NAME is not running."
+ exit 3
+ fi
+
+ if read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
+ echo "$NAME is running."
+ exit 0
+ else
+ echo "$NAME is not running but $PIDFILE exists."
+ exit 1
+ fi
+ ;;
*)
N=/etc/init.d/$NAME
- # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
- echo "Usage: $N {start|stop|restart|force-reload}" >&2
+ # echo "Usage: $N {start|stop|restart|status|reload|force-reload}" >&2
+ echo "Usage: $N {start|stop|restart|status|force-reload}" >&2
exit 1
;;
esac