def deamon_command(command, timer, debug, time_out, is_daemon): wk = Work(timer=timer, pid_file=PID_FILE, debug=debug, time_out=time_out, is_daemon=is_daemon) if command == DAEMON_START: wk.start() elif command == DAEMON_STOP: wk.stop() elif command == DAEMON_RESTART: wk.stop() time.sleep(3) wk.start()