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>
This commit is contained in:
parent
0d6f054dbb
commit
066a45d760
@ -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 "$@";
|
||||
|
Loading…
x
Reference in New Issue
Block a user