37,721
社区成员
发帖
与我相关
我的任务
分享
'''获取服务进程ID'''
stdin, stdout, stderr = mySSHclient.exec_command("ps -ef|grep 'BMP' | awk '{print $2}'")
pid = [i[:-1] for i in stdout.readlines()]
print pid[0]
stdin, stdout, stderr = mySSHclient.exec_command("'kill -9 %s',pid[0]")
print stdout.read()
stdin, stdout, stderr = mySSHclient.exec_command('kill -9 %s' % pid[0])