summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Asir <tjeyasin@redhat.com>2014-06-10 10:18:10 +0530
committerBala FA <barumuga@redhat.com>2014-06-20 03:08:35 -0700
commit66cc1bb198024faf534f51c64ed077c61a4ed433 (patch)
treefb2250fb77dee5f07f785c2ae272090e2fce47dd
parentd89e8d4ba22635e49f9d6a9bb9fa740f26bb538d (diff)
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 <tjeyasin@redhat.com> Reviewed-on: http://review.gluster.org/8021 Tested-by: Timothy Asir <tim.gluster@gmail.com> Reviewed-by: Kanagaraj M <kmayilsa@redhat.com> Reviewed-by: Shubhendu Tripathi <shtripat@redhat.com> Reviewed-by: Bala FA <barumuga@redhat.com>
-rwxr-xr-xplugins/glusterpmd31
1 files changed, 23 insertions, 8 deletions
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 $?