def start(self, devel=False): self.config.read_file(open(self._config_file)) if devel: self._app(devel=True) daemon = DaemonContext(pidfile=PidFile(self.pid)) if self.nodaemon: daemon.detach_process = False dlog = open(self.config.get('main', 'dlog'), 'w') daemon.stderr = dlog daemon.stdout = dlog daemon.open() self._app()
def start(self, devel=False): self.config.read_file(open(self._config_file)) if devel: self._app(devel=True) daemon = DaemonContext(pidfile=PidFile(self.pid)) if self.nodaemon: daemon.detach_process = False dlog = open(self.config.get("main", "dlog"), "w") daemon.stderr = dlog daemon.stdout = dlog daemon.open() self._app()
def start(self): console_log = logging.StreamHandler() console_log.setLevel('DEBUG') self.log.addHandler(console_log) if not self._cfg_open(): print("could not process config") sys.exit(1) daemon = DaemonContext(pidfile=PidFile(self.pid)) if self.nodaemon: daemon.detach_process = False dlog = open(self.config.get('main', 'dlog_file'), 'w') daemon.stderr = dlog daemon.stdout = dlog daemon.open() signal.signal(signal.SIGHUP, self._reload) signal.signal(signal.SIGTERM, self._quit) self.log.removeHandler(console_log) self._run()
def start(self, devel=False): self.config.read_file(open(self._config_file)) self._config_dict = self._cfg_to_dict(self.config) try: jsonschema.validate(self.config_dict['main'], CHECK_CONFIG_MAIN) except jsonschema.exceptions.ValidationError as err: print("main section: {0}".format(err)) sys.exit(1) if devel: self._app(devel=True) return daemon = DaemonContext(pidfile=PidFile(self.pid)) if self.nodaemon: daemon.detach_process = False dlog = open(self.config.get('main', 'dlog'), 'w') daemon.stderr = dlog daemon.stdout = dlog daemon.open() self._app()