summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/test_func.py3
-rwxr-xr-xmodules/process.py13
2 files changed, 14 insertions, 2 deletions
diff --git a/client/test_func.py b/client/test_func.py
index 866af36..6362b85 100644
--- a/client/test_func.py
+++ b/client/test_func.py
@@ -18,11 +18,12 @@ print s.test.add(1, 2)
if TEST_PROCESS:
print s.process.info()
+ print s.process.pkill("thunderbird")
# here's the service module testing
if TEST_SERVICES:
print s.service.restart("httpd")
-
+
if TEST_HARDWARE:
print s.hardware.info()
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