summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/kill.py
diff options
context:
space:
mode:
authorgsmselftest2011-10-14 16:47:54 +0200
committergsmselftest2011-10-14 16:47:54 +0200
commit42eef9ac46c877cc186715ae327d105b66b9e786 (patch)
tree7c43edceed48c205e68fc6c4fafadd17eb592bdd /For Weekly Test/kill.py
parentset process name example (diff)
downloadgsm-selftest-42eef9ac46c877cc186715ae327d105b66b9e786.tar.gz
gsm-selftest-42eef9ac46c877cc186715ae327d105b66b9e786.tar.xz
gsm-selftest-42eef9ac46c877cc186715ae327d105b66b9e786.zip
rearragne backup file.
Diffstat (limited to 'For Weekly Test/kill.py')
-rw-r--r--For Weekly Test/kill.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/For Weekly Test/kill.py b/For Weekly Test/kill.py
new file mode 100644
index 0000000..e41f802
--- /dev/null
+++ b/For Weekly Test/kill.py
@@ -0,0 +1,21 @@
+import subprocess, signal
+import os
+
+#kill process to make sure, that the handler is Terminate incase handler having problem receiving
+# terminate message from controller
+
+def killProc():
+ # define process name of the Handler
+ procName1 = 'foo'
+ #procName = 'SIP Handler'
+ p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE)
+ out, err = p.communicate()
+
+ #search process name and kill it.
+ for line in out.splitlines():
+ if procName1 in line:
+ pid = int(line.split(None, 1)[0])
+ os.kill(pid, signal.SIGKILL)
+
+
+killProc()