first commit, 去掉大文件后新建的git库,和老库的提交17ce6ae一样
This commit is contained in:
33
kill_psdk.py
Normal file
33
kill_psdk.py
Normal file
@ -0,0 +1,33 @@
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
def get_process_id(name):
|
||||
child = subprocess.Popen(["pgrep","-f",name],stdout=subprocess.PIPE,shell=False)
|
||||
response = child.communicate()[0]
|
||||
return response
|
||||
|
||||
pids = get_process_id("psdk_demo")
|
||||
pids = pids.splitlines()
|
||||
print type(pids)
|
||||
print pids
|
||||
if not pids:
|
||||
print "no target pid to kill,please check"
|
||||
sys.exit(1)
|
||||
|
||||
f=open('/media/nvme/300TC/programRunLog/djiLog/Number_of_runs.txt')
|
||||
signal=[]
|
||||
for line in f:
|
||||
signal.append(line.strip())
|
||||
f.close()
|
||||
signal_int=int(signal[0])
|
||||
|
||||
|
||||
for pid in pids:
|
||||
if (signal_int % 2) != 0:
|
||||
result=os.system("kill -9 "+pid)
|
||||
if result==0:
|
||||
print "execute kill success"
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
Reference in New Issue
Block a user