From c00987ffc067f55b2e64e90dda861f095fc8ef9d Mon Sep 17 00:00:00 2001 From: Evan Cui Date: Thu, 5 Jul 2018 21:10:16 +0800 Subject: [PATCH] Fix the script error --- nodemanager/scripts/EndTask.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nodemanager/scripts/EndTask.sh b/nodemanager/scripts/EndTask.sh index 14ae459..1fb3874 100644 --- a/nodemanager/scripts/EndTask.sh +++ b/nodemanager/scripts/EndTask.sh @@ -64,10 +64,13 @@ if $CGInstalled; then ((maxLoop--)) done else - if [ "$forced" == "1" ]; then - kill -s 9 $(pstree -l -p "$processId" | grep "([[:digit:]]*)" -o | tr -d '()') - else - kill -s SIGINT $(pstree -l -p "$processId" | grep "([[:digit:]]*)" -o | tr -d '()') + $pid = $(pstree -l -p "$processId" | grep "([[:digit:]]*)" -o | tr -d '()') + if [ -n "$pid" ]; then + if [ "$forced" == "1" ]; then + kill -s 9 $pid + else + kill -s SIGINT $pid + fi fi fi