From d65e8a871aa81ef7d2275da025f66d6e6dabc47c Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 15 Nov 2013 13:17:42 +0530 Subject: extras: add a script to stop all the glusterfs process Change-Id: I9f73bf0308625695ed78db06478963d16644852a Signed-off-by: Amar Tumballi Reviewed-on: http://review.gluster.org/6270 Reviewed-by: Sachidananda Urs Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- extras/stop-all-gluster-processes.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 extras/stop-all-gluster-processes.sh diff --git a/extras/stop-all-gluster-processes.sh b/extras/stop-all-gluster-processes.sh new file mode 100755 index 00000000000..6c81a301c72 --- /dev/null +++ b/extras/stop-all-gluster-processes.sh @@ -0,0 +1,33 @@ +#! /bin/sh + +function main() +{ + for pidfile in $(find /var/lib/glusterd/ -iname '*pid'); + do + pid=$(cat ${pidfile}); + echo "sending SIGTERM to process $pid"; + kill -TERM $pid; + done + + # for geo-replication, only 'monitor' has pid file written, other + # processes are not having a pid file, so get it through 'ps' and + # handle these processes + gsyncpid=`ps aux | grep gluster | grep gsync | awk '{print $2}'`; + test -n $gsyncpid && kill -TERM $gsyncpid; + + sleep 5; + + # if pid file still exists, its something to KILL + for pidfile in $(find /var/lib/glusterd/ -iname '*pid'); + do + pid=$(cat ${pidfile}); + echo "sending SIGKILL to process $pid"; + kill -KILL $pid; + done + + # handle 'KILL' of geo-replication + gsyncpid=`ps aux | grep gluster | grep gsync | awk '{print $2}'`; + test -n $gsyncpid && kill -KILL $gsyncpid; +} + +main "$@"; -- cgit