From 66cc1bb198024faf534f51c64ed077c61a4ed433 Mon Sep 17 00:00:00 2001 From: Timothy Asir Date: Tue, 10 Jun 2014 10:18:10 +0530 Subject: Add status and condrestart options to glusterpmd service Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1110719 Change-Id: I28af8b335af7dd9cc0ea58b98923261f95fc98dc Signed-off-by: Timothy Asir Reviewed-on: http://review.gluster.org/8021 Tested-by: Timothy Asir Reviewed-by: Kanagaraj M Reviewed-by: Shubhendu Tripathi Reviewed-by: Bala FA --- plugins/glusterpmd | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'plugins/glusterpmd') diff --git a/plugins/glusterpmd b/plugins/glusterpmd index 383057e..f6145be 100755 --- a/plugins/glusterpmd +++ b/plugins/glusterpmd @@ -23,6 +23,9 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # +# Source function library. +. /etc/rc.d/init.d/functions + BASE=glusterpmd # Fedora File System Layout dictates /run @@ -31,6 +34,16 @@ PIDFILE="${RUNDIR:-/var/run}/${BASE}.pid" PID=`test -f $PIDFILE && cat $PIDFILE` +restart() +{ + if [ -f $PIDFILE ]; then + echo "Restarting gluster process monitoring service" + python /usr/lib64/nagios/plugins/gluster/check_proc_status.py restart + else + python /usr/lib64/nagios/plugins/gluster/check_proc_status.py start + fi +} + case "$1" in start) if [ -f $PIDFILE ]; then @@ -46,18 +59,20 @@ case "$1" in python /usr/lib64/nagios/plugins/gluster/check_proc_status.py stop fi ;; + status) + status $BASE + ;; + condrestart) + status $BASE > /dev/null || exit 0 + restart + ;; restart) - if [ -f $PIDFILE ]; then - echo "Restarting gluster process monitoring service" - python /usr/lib64/nagios/plugins/gluster/check_proc_status.py restart - else - python /usr/lib64/nagios/plugins/gluster/check_proc_status.py start - fi + restart ;; *) - echo "Usage: /etc/init.d/glusterpmd {start|stop|restart}" + echo "Usage: /etc/init.d/glusterpmd {start|stop|status|restart|condrestart}" exit 1 ;; esac -exit 0 +exit $? -- cgit