def start_daemon_service(func, pid_file): pid = os.fork() if pid == 0: func() else: # 父进程, logger.info('controller process started at PID: ' + str(pid)) save_pid(pid_file, pid)
def start_service(func, pid_file): pid = os.fork() if pid == 0: func() else: # saved PID of child process logger.info('controller process started at PID: ' + str(pid)) save_pid(pid_file, pid)
def start_service(func, pid_file): pid = os.getpid() # saved PID logger.info('controller process started at PID: ' + str(pid)) save_pid(pid_file, pid) func()