summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/Advance/procname-0.2/kill.py
diff options
context:
space:
mode:
authortt412011-10-04 19:12:47 +0200
committertt412011-10-04 19:12:47 +0200
commite8c39470ee5e455fc527afeae11441e08b683432 (patch)
tree7b7530bce36246c8ebc19a15b9c039d5b231e5c1 /For Weekly Test/Advance/procname-0.2/kill.py
parentfix some bug (diff)
downloadgsm-selftest-e8c39470ee5e455fc527afeae11441e08b683432.tar.gz
gsm-selftest-e8c39470ee5e455fc527afeae11441e08b683432.tar.xz
gsm-selftest-e8c39470ee5e455fc527afeae11441e08b683432.zip
testing file for kill process
Diffstat (limited to 'For Weekly Test/Advance/procname-0.2/kill.py')
-rw-r--r--For Weekly Test/Advance/procname-0.2/kill.py25
1 files changed, 19 insertions, 6 deletions
diff --git a/For Weekly Test/Advance/procname-0.2/kill.py b/For Weekly Test/Advance/procname-0.2/kill.py
index e2549e5..d999917 100644
--- a/For Weekly Test/Advance/procname-0.2/kill.py
+++ b/For Weekly Test/Advance/procname-0.2/kill.py
@@ -1,11 +1,24 @@
import subprocess, signal
import os
-p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE)
-out, err = p.communicate()
+#kill process to make sure, that the handler is Terminate incase handler having problem receiving
+# terminate message from controller
-for line in out.splitlines():
- if 'My super name' in line:
- pid = int(line.split(None, 1)[0])
- os.kill(pid, signal.SIGKILL)
+def killProc(handlerName):
+ # define process name of the Handler
+ if handlerName[0:3]== 'GSM':
+ procName = 'GSM Handler'
+ else:
+ 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 procName in line:
+ pid = int(line.split(None, 1)[0])
+ os.kill(pid, signal.SIGKILL)
+
+
+killProc('sip') \ No newline at end of file