mirror of https://github.com/fail2ban/fail2ban
- Added new PID lock file management
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_5@170 a942ae1a-1317-0410-a47c-b1dcaea8d6050.5
parent
9761d31f4b
commit
1fcf7612fd
11
fail2ban
11
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()
|
||||
|
|
Loading…
Reference in New Issue