summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/kill.py
blob: e41f802606c76a09f14e28557f2384ef4558369a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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()