def signal_handler(signum, _): """Signal handler to close and reopen log file(s) on HUP and exit on TERM.""" if signum == signal.SIGHUP: logger.info("SIGHUP received; reopening log files.") nav.logs.reopen_log_files() daemon.redirect_std_fds(stderr=nav.logs.get_logfile_from_logger()) logger.info("Log files reopened.") elif signum == signal.SIGTERM: logger.warn('SIGTERM received: Shutting down.') sys.exit(0)
def signal_handler(signum, _): """Signal handler to close and reopen log file(s) on HUP and exit on TERM.""" if signum == signal.SIGHUP: logger.info("SIGHUP received; reopening log files.") nav.logs.reopen_log_files() daemon.redirect_std_fds(stderr=nav.logs.get_logfile_from_logger()) logger.info("Log files reopened.") elif signum == signal.SIGTERM: logger.warn('SIGTERM received: Shutting down.') sys.exit(0)
def signal_handler(signum, _): """Signal handler to close and reopen log file(s) on HUP and exit on TERM""" if signum == signal.SIGHUP: _logger.info("SIGHUP received; reopening log files.") nav.logs.reopen_log_files() logfile = open(logfile_path, 'a') daemon.redirect_std_fds(stdout=logfile, stderr=logfile) nav.logs.reset_log_levels() nav.logs.set_log_config() _logger.info('Log files reopened.') elif signum == signal.SIGTERM: _logger.warning('SIGTERM received: Shutting down.') sys.exit(0)