- os.system("/etc/init.d/codemux stop")
- f = os.popen("/sbin/pidof codemux")
- tmp = f.readlines()
- f.close()
- if len(tmp) > 0:
- pids = tmp[0].rstrip("\n").split()
- for pid in pids:
- logger.log("codemux: Killing stalled pid %s" % pid, 2)
- os.kill(pid, 9)
- os.system("/etc/init.d/codemux start")
+ if isRunning():
+ logger.log_call(["/etc/init.d/codemux","condrestart", ])
+ else:
+ logger.log_call(["/etc/init.d/codemux","restart", ])
+
+def startService():
+ if not os.path.exists("/etc/init.d/codemux"): return
+ if not isRunning():
+ logger.log("codemux: Starting codemux service")
+ logger.log_call(["/etc/init.d/codemux", "start", ])
+ logger.log_call(["/sbin/chkconfig", "codemux", "on"])
+
+
+def stopService():
+ if not os.path.exists("/etc/init.d/codemux"): return
+ if isRunning():
+ logger.log("codemux: Stopping codemux service")
+ logger.log_call(["/etc/init.d/codemux", "stop", ])
+ logger.log_call(["/sbin/chkconfig", "codemux", "off"])
+