summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-09-21 18:23:31 -0400
committerMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-09-21 18:23:31 -0400
commita64a59585222a0b10a1e6181c67d53dde6570a34 (patch)
tree2a2e882b86ff0a78c9a6dc9ceac859651489d0e4 /modules
parent74b4897547980bf8512be7806d1ee8f5ef28aaf8 (diff)
downloadthird_party-func-a64a59585222a0b10a1e6181c67d53dde6570a34.tar.gz
third_party-func-a64a59585222a0b10a1e6181c67d53dde6570a34.tar.xz
third_party-func-a64a59585222a0b10a1e6181c67d53dde6570a34.zip
Added kill and pkill to the process module
Diffstat (limited to 'modules')
-rwxr-xr-xmodules/process.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/process.py b/modules/process.py
index 91b7939..064b1b3 100755
--- a/modules/process.py
+++ b/modules/process.py
@@ -26,7 +26,9 @@ from modules import func_module
class ProcessModule(func_module.FuncModule):
def __init__(self):
self.methods = {
- "info": self.info
+ "info" : self.info,
+ "kill" : self.kill,
+ "pkill" : self.pkill
}
func_module.FuncModule.__init__(self)
@@ -50,6 +52,15 @@ class ProcessModule(func_module.FuncModule):
return results
+ def kill(self,pid,level=""):
+ rc = subprocess.call("/bin/kill %s %s" % (pid, level), shell=True)
+ return rc
+
+ def pkill(self,name,level=""):
+ # example killall("thunderbird","-9")
+ rc = subprocess.call("/usr/bin/pkill %s %s" % (name, level), shell=True)
+ return rc
+
methods = ProcessModule()
register_rpc = methods.register_rpc