glusterfs/extras/stop-all-gluster-processes.sh
Kotresh HR 85865daa1b extras: Fix stop-all-gluster-processes.sh script
"test -n" command takes single string as argument. The
command was failing with "Too many arguments" when multiple
pids are got.

Change-Id: Icc409082f492c72522168d5e203684f00f52cf1b
BUG: 1204641
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/9970
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2015-04-06 10:44:35 -07:00

34 lines
923 B
Bash
Executable File

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