summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShubhendu Tripathi <shtripat@redhat.com>2015-07-22 16:55:06 +0530
committerNiels de Vos <ndevos@redhat.com>2015-11-10 00:56:57 -0800
commit066a45d76021bfda09bdb57108d677eae7eba92b (patch)
tree5fb146bb6ecf40cc1c9076bd1ec7fcf0ef748399
parent0d6f054dbbeffa7190cb41746251c6b77be59a53 (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: 1277533 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>
-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 "$@";