def monitorDaemon(): if util.checkProcessStatusByName("AutoDeployServer-monitorDaemon"): return try: pid = os.fork() except OSError, e: print e
def daemonDoSomeThing(callback=None): #检测守护进程是否已经启动 if util.checkProcessStatusByName("AutoDeployServer-watchDirByDb"): return util.createFile(setting.daemonLogPath) try: pid = os.fork() except OSError, e: print e
def _intervalMonitorDaemon(signum = None, frame=None): if not util.checkProcessStatusByName("AutoDeployServer-watchDirByDb"): g.logger.critical('AutoDeployServer-watchDirByDb down!') #启动 daemonDoSomeThing(watchDirByDb) try: pid, status = os.wait() g.logger.debug("wait success: %d, %d" %(pid, status)) except OSError, e: g.logger.debug("wait error: %s" %e)