global stop_signal_flag if stop_signal_flag: return stop_signal_flag = True c.stop () return c.start () signal.signal (signal.SIGTERM, exit_sig_handler) signal.signal (signal.SIGINT, exit_sig_handler) c.loop () return def usage (): # print "usage:\t%s star/stop/restart\t#manage forked daemon" % (sys.argv[0]) print "\t%s run ID \t\t# run without daemon, for test purpose" % (sys.argv[0]) os._exit (1) if __name__ == '__main__': if len (sys.argv) <= 2: usage () else: logger = Log ("daemon", config=config) # to ensure log is permitted to write pid_file = "paxos_server.pid" mon_pid_file = "paxos_server_mon.pid" action = sys.argv[1] daemon.cmd_wrapper (action, main, usage, logger, config.log_dir, config.RUN_DIR, pid_file, mon_pid_file) # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 :
prog.stop() return prog.start() signal.signal(signal.SIGTERM, exit_sig_handler) signal.signal(signal.SIGINT, exit_sig_handler) prog.loop() return def usage(): print "usage:\t%s star/stop/restart\t#manage forked daemon" % (sys.argv[0]) print "\t%s run\t\t# run without daemon, for test purpose" % (sys.argv[0]) os._exit(1) if __name__ == "__main__": logger = Log("daemon", config=conf) # to ensure log is permitted to write pid_file = "saas_mon.pid" mon_pid_file = "saas_mon_mon.pid" if len(sys.argv) <= 1: usage() else: action = sys.argv[1] daemon.cmd_wrapper(action, _main, usage, logger, conf.log_dir, "/tmp", pid_file, mon_pid_file) # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 :
signal.signal(signal.SIGINT, exit_sig_handler) client.loop() return def usage(): print "usage:\t%s star/stop/restart\t#manage forked daemon" % (sys.argv[0]) print "\t%s run\t\t# run without daemon, for test purpose" % (sys.argv[0]) print "\t%s gen\t\t# generate config and reload nginx immediately" % ( sys.argv[0]) os._exit(1) if __name__ == '__main__': if len(sys.argv) <= 1: usage() else: logger = Log("daemon", config=config) # to ensure log is permitted to write pid_file = "mtgox_streamproc.pid" mon_pid_file = "mtgox_streamproc_mon.pid" action = sys.argv[1] if action == 'gen': p = VpsProxy() p.gen_config(force=True) else: daemon.cmd_wrapper(action, main, usage, logger, config.log_dir, config.RUN_DIR, pid_file, mon_pid_file) # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 :
prog.start() signal.signal(signal.SIGTERM, exit_sig_handler) signal.signal(signal.SIGINT, exit_sig_handler) prog.loop() return def usage(): print "usage:\t%s star/stop/restart\t#manage forked daemon" % (sys.argv[0]) print "\t%s run\t\t# run without daemon, for test purpose" % (sys.argv[0]) os._exit(1) if __name__ == "__main__": logger = Log("daemon", config=conf) # to ensure log is permitted to write pid_file = "saas_mon.pid" mon_pid_file = "saas_mon_mon.pid" if len(sys.argv) <= 1: usage() else: action = sys.argv[1] daemon.cmd_wrapper(action, _main, usage, logger, conf.log_dir, "/tmp", pid_file, mon_pid_file) # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 :