ya2 · news · projects · code · about

renamed lib to ya2
[pmachines.git] / ya2 / tools / kill_yorg_server.py
1 # this kills yocto's server
2 from subprocess import Popen, PIPE
3 from os import system
4
5
6 def exec_cmd(cmd):
7 ret = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True).communicate()
8 return '\n'.join(ret)
9
10
11 grep = "grep -E 'python.*server.*yocto.*main.py|python.*yocto.*server.*main.py'"
12 proc_line = exec_cmd('ps aux | ' + grep).split('\n')[0]
13 srv_pid = proc_line.split()[1]
14 system('kill -9 ' + srv_pid)