Flush logs at USR1 signal

pull/979/head
Teubel György 2015-02-02 16:46:18 +01:00
parent 50cbd4e9eb
commit 0254cbf7fb
2 changed files with 6 additions and 0 deletions

View File

@ -62,6 +62,7 @@ ver. 0.9.2 (2014/XX/XXX) - wanna-be-released
- empty or "basic" works as-is
- "cymru" additionally prints (ASN, Country RIR) per banned IP
(requires dnspython or dnspython3)
- Flush log at USR1 signal
- Enhancements:
* Enable multiport for firewallcmd-new action. Closes gh-834

View File

@ -71,12 +71,17 @@ class Server:
logSys.debug("Caught signal %d. Exiting" % signum)
self.quit()
def __sigUSR1Handler(self, signum, fname):
logSys.debug("Caught signal %d. Flushing logs" % signum)
self.flushLogs()
def start(self, sock, pidfile, force = False):
logSys.info("Starting Fail2ban v" + version.version)
# Install signal handlers
signal.signal(signal.SIGTERM, self.__sigTERMhandler)
signal.signal(signal.SIGINT, self.__sigTERMhandler)
signal.signal(signal.SIGUSR1, self.__sigUSR1handler)
# Ensure unhandled exceptions are logged
sys.excepthook = excepthook