extras: add a script to stop all the glusterfs process

Change-Id: I9f73bf0308625695ed78db06478963d16644852a
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: http://review.gluster.org/6270
Reviewed-by: Sachidananda Urs <sacchi@gmail.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
Amar Tumballi 2013-11-15 13:17:42 +05:30 committed by Vijay Bellur
parent 53d932b490
commit d65e8a871a

View File

@ -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 "$@";