diff options
author | Juliy V. Chirkov <juliyvchirkov@gmail.com> | 2017-01-08 03:50:07 +0200 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2017-02-26 10:25:47 -0800 |
commit | 9c843d2f2975b96f5754ccefbde2b0283fa62acb (patch) | |
tree | 53f89ecc2032f2b1dc94b44baccfcc97a8046301 /scripts | |
parent | 70942bdf061d69e294d7eb94bcde2a9eec971c66 (diff) | |
download | memcached-9c843d2f2975b96f5754ccefbde2b0283fa62acb.tar.gz |
+status check routine
one can check status of sole memcached daemon if there’re no instances configured (this is default behaviour on request made in common way w/o xtra args) or check status of some instance from bunch
an outcome is short diagnostic message along w/ appropriate ret code
— status of sole memcached daemon
/etc/init.d/memcached status
/sbin/service memcached status
— status of memcached instance ’instance001’
/etc/init.d/memcached status instance001
/sbin/service memcached status instance001
— status of memcached instance ’instance014’
/etc/init.d/memcached status instance014
/sbin/service memcached status instance014
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/memcached-init | 15 |
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 |