hope I got the merge wright...
[monitor.git] / tools / kill.cmd.sh
diff --git a/tools/kill.cmd.sh b/tools/kill.cmd.sh
new file mode 100755 (executable)
index 0000000..d898a7a
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+if [ -z "$1" ] ; then
+       echo "getting pid list"
+       l=`ps ax | grep automate | grep -v grep | awk '{print $1}'`
+else
+       l=$1
+fi
+
+for pid  in $l ; do 
+       pstree -p -a -A $pid | awk -F ',' '{print $2}' | \
+               awk '{print $1}' | tr ')' ' ' | xargs kill  || :
+done