def __init__(self, args, pid_file): self.is_force = args.force self.worker = int(args.worker) Daemon.__init__(self, pid_file) if args.force == False: self.start() if args.force == True: self.restart()
def __init__(self, pid_file): Daemon.__init__(self, pid_file) self.stop()
def __init__(self,pid_file): Daemon.__init__(self, pid_file) self.statut()
#!/usr/bin/python3 #coding:utf8 import sys import common from engine.handler import event_manager from engine import main from common.Daemon import Daemon if __name__ == '__main__': sys.excepthook = common.new_hook daemon = Daemon('watch_process.pid') if len(sys.argv) == 2: if 'start' == sys.argv[1]: daemon.start() elif 'stop' == sys.argv[1]: daemon.stop() elif 'restart' == sys.argv[1]: daemon.restart() else: print('unknown command') sys.exit(2) sys.exit(0) elif len(sys.argv) == 1: main(event_manager) else: print('usage: %s start|stop|restart' % sys.argv[0]) sys.exit(2)