Commit 1411af8e authored by Łukasz Nowak's avatar Łukasz Nowak

Simple utility to kill pid stored in files.

parent 96ffb553
......@@ -49,6 +49,7 @@ setup(name=name,
'slapmonitor = slapos.monitor:run_slapmonitor',
'slapreport = slapos.monitor:run_slapreport',
'slaprunner = slapos.runner:run',
'killpidfromfile = slapos.systool:killpidfromfile',
]
},
)
import sys
import os
import signal
def killpidfromfile():
if len(sys.argv) != 3:
raise ValueError('Invocation: %s <pidfile> <signal name>' % sys.argv[0])
file = sys.argv[1]
sig = getattr(signal, sys.argv[2], None)
if sig is None:
raise ValueError('Unknwon signal name %s' % sys.argv[2])
pid = int(open(file).read())
print 'Killing pid %s with signal %s' % (pid, sys.argv[2])
os.kill(pid, sig)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment