summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShubhendu Tripathi <shtripat@redhat.com>2015-07-22 16:55:06 +0530
committerVenky Shankar <vshankar@redhat.com>2015-11-11 23:27:47 -0800
commit1e746edf35f5e1dd62f189fdc6c045a5d1482fa8 (patch)
tree5d2b1e0976b9aed8a0d03a18e7d6cee837c7dd63
parentcdda95b317ea63f30d79a7536f8881aca03c136e (diff)
extras: Exit with SUCCESS if no processes to stop
This script might be executed even when there are no valid processes running to be stopped. In this scenario, the script should return with SUCCESS Change-Id: Ia293214a4b5052bc4bef9769f197f7b05c55ffe9 BUG: 1279776 Signed-off-by: Shubhendu Tripathi <shtripat@redhat.com> Reviewed-on: http://review.gluster.org/11739 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/12564 Tested-by: Ramesh N <rnachimu@redhat.com> Reviewed-by: Aravinda VK <avishwan@redhat.com>
-rwxr-xr-xextras/stop-all-gluster-processes.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/extras/stop-all-gluster-processes.sh b/extras/stop-all-gluster-processes.sh
index 087afa4cf22..25dc0ba6bf6 100755
--- a/extras/stop-all-gluster-processes.sh
+++ b/extras/stop-all-gluster-processes.sh
@@ -2,6 +2,8 @@
function main()
{
+ errors=0;
+
for pidfile in $(find /var/lib/glusterd/ -iname '*pid');
do
pid=$(cat ${pidfile});
@@ -13,7 +15,10 @@ function main()
# 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;
+ if [ -n "$gsyncpid" ]
+ then
+ kill -TERM $gsyncpid || errors=$(($errors + 1));
+ fi
sleep 5;
@@ -27,7 +32,12 @@ function main()
# handle 'KILL' of geo-replication
gsyncpid=`ps aux | grep gluster | grep gsync | awk '{print $2}'`;
- test -n "$gsyncpid" && kill -KILL $gsyncpid;
+ if [ -n "$gsyncpid" ]
+ then
+ kill -KILL $gsyncpid || errors=$(($errors + 1));
+ fi
+
+ exit $errors;
}
main "$@";