azkaban-aplcache

Shutdown the process with kill -9 at the end in shutdown scripts

3/16/2017 6:24:51 PM

Details

diff --git a/azkaban-common/src/main/bash/util.sh b/azkaban-common/src/main/bash/util.sh
index aebfd3e..5290b0b 100755
--- a/azkaban-common/src/main/bash/util.sh
+++ b/azkaban-common/src/main/bash/util.sh
@@ -34,6 +34,15 @@ function kill_process_with_retry {
      fi
     done
 
-   echo "Error: unable to kill process for $maxattempt attempt(s), shutdown failed"
-   return 1
-}
\ No newline at end of file
+   echo "Error: unable to kill process for $maxattempt attempt(s), killing the process with -9"
+   kill -9 $pid
+   sleep 5
+   if [[ -n "$(ps -p $pid -o pid=)" ]]; then
+      echo "$pname is not dead even after kill -9 [pid: $pid]"
+      return 1
+   else
+    echo "shutdown succeeded"
+    return 0
+   fi
+}
+