diff --git a/fail2ban b/fail2ban index f904271d..25777b3b 100755 --- a/fail2ban +++ b/fail2ban @@ -31,12 +31,16 @@ import sys, traceback, logging # Appends our own modules path. sys.path.append("/usr/lib/fail2ban") -# Now we can import our module. +# Now we can import our modules. import fail2ban +from utils.pidlock import PIDLock -# Gets the instance of the logger. +# Get the instance of the logger. logSys = logging.getLogger("fail2ban") +# Get PID lock file instance +pidLock = PIDLock() + # Start the application. Handle all the unhandled exceptions try: fail2ban.main() @@ -44,10 +48,13 @@ except SystemExit: # We called sys.exit(). Nothing wrong so just pass pass except Exception, e: + # Print the exception data (type, value, tb) = sys.exc_info() tbStack = traceback.extract_tb(tb) logSys.error("Fail2Ban got an unhandled exception and died.") logSys.error("Type: " + `type.__name__` + "\n" + "Value: " + `e.args` + "\n" + "TB: " + `tbStack`) + # Remove the PID lock file. Should close #1239562 + pidLock.remove() logging.shutdown()