blob: a8274490254f53501f5d6b463ebb0514462d6201 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/usr/bin/env python
from subprocess import check_output
from psutil import Process
args = set([
'/usr/bin/twistd',
'--python=/usr/lib/python2.7/dist-packages/leap/soledad/server/server.tac',
])
def get_soledad_server_pid():
output = check_output(['pidof', 'python'])
for pid in output.split():
proc = Process(int(pid))
cmdline = proc.cmdline()
if args.issubset(set(cmdline)):
return int(pid)
if __name__ == '__main__':
print get_soledad_server_pid()
|