summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/memcached-init15
1 files changed, 13 insertions, 2 deletions
diff --git a/scripts/memcached-init b/scripts/memcached-init
index ebe2ab0..bd8e273 100755
--- a/scripts/memcached-init
+++ b/scripts/memcached-init
@@ -85,7 +85,18 @@ case "$1" in
echo "$NAME."
rm -f $PIDFILE
;;
-
+ status)
+ [ $# -lt 2 ] && NAME=$DAEMONNAME
+ PIDFILE="/var/run/$NAME.pid"
+ set +e
+ start-stop-daemon --status --pidfile $PIDFILE
+ case $? in
+ 0) echo "$DESC: $NAME (pid $(cat $PIDFILE)) is running" && exit 0;;
+ 1) echo "$DESC: $NAME is not running thro' the pid file exists" && rm -f $PIDFILE && exit 1;;
+ 3) echo "$DESC: $NAME is not running" && exit 3;;
+ 4) echo "$DESC: $NAME status is unclear, sorry" && exit 4;;
+ esac
+ ;;
restart|force-reload)
#
# If the "reload" option is implemented, move the "force-reload"
@@ -102,7 +113,7 @@ case "$1" in
*)
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|status|restart|force-reload}" >&2
exit 1
;;
esac