From: Sebastian Harl Date: Sun, 6 Jan 2008 17:12:17 +0000 (+0100) Subject: Added support for the "status" command to the init script. X-Git-Tag: collectd-4.2.4-1~6 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b0330425088c3c890522d32b5be4180f87c54d5b;p=pkg-collectd.git Added support for the "status" command to the init script. --- diff --git a/debian/collectd.init.d b/debian/collectd.init.d index 42a90cd..18ece44 100755 --- a/debian/collectd.init.d +++ b/debian/collectd.init.d @@ -78,6 +78,24 @@ d_stop() { fi } +d_status() { + PID=$( cat "$PIDFILE" 2> /dev/null ) || true + + if test -n "$PID" && kill -0 $PID 2> /dev/null; then + echo "collectd ($PID) is running." + exit 0 + else + PID=$( pidof collectd ) || true + + if test -n "$PID"; then + echo "collectd ($PID) is running." + exit 0 + else + echo "collectd is stopped." + fi + fi +} + case "$1" in start) echo -n "Starting $DESC: $NAME" @@ -89,6 +107,9 @@ case "$1" in d_stop echo "." ;; + status) + d_status + ;; restart|force-reload) echo -n "Restarting $DESC: $NAME" d_stop