Skip to content

Commit

Permalink
- Fixed PID file while started in daemon mode. Thanks to Christian Jo…
Browse files Browse the repository at this point in the history
…bic who submitted a similar patch.

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@680 a942ae1a-1317-0410-a47c-b1dcaea8d605
  • Loading branch information
lostcontrol committed Mar 13, 2008
1 parent 19d251d commit b174a2e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Expand Up @@ -14,6 +14,8 @@ ver. 0.8.3 (2008/??/??) - stable
Thanks to Yaroslav Halchenko.
- Fixed socket path in redhat and suse init script. Thanks to
Jim Wight.
- Fixed PID file while started in daemon mode. Thanks to
Christian Jobic who submitted a similar patch.

ver. 0.8.2 (2008/03/06) - stable
----------
Expand Down
19 changes: 10 additions & 9 deletions server/server.py
Expand Up @@ -59,15 +59,6 @@ def __sigTERMhandler(self, signum, frame):
def start(self, sock, force = False):
logSys.info("Starting Fail2ban v" + version.version)

# Creates a PID file.
try:
logSys.debug("Creating PID file %s" % Server.PID_FILE)
pidFile = open(Server.PID_FILE, 'w')
pidFile.write("%s\n" % os.getpid())
pidFile.close()
except IOError, e:
logSys.error("Unable to create PID file: %s" % e)

# Install signal handlers
signal.signal(signal.SIGTERM, self.__sigTERMhandler)
signal.signal(signal.SIGINT, self.__sigTERMhandler)
Expand All @@ -81,6 +72,16 @@ def start(self, sock, force = False):
else:
logSys.error("Could not create daemon")
raise ServerInitializationError("Could not create daemon")

# Creates a PID file.
try:
logSys.debug("Creating PID file %s" % Server.PID_FILE)
pidFile = open(Server.PID_FILE, 'w')
pidFile.write("%s\n" % os.getpid())
pidFile.close()
except IOError, e:
logSys.error("Unable to create PID file: %s" % e)

# Start the communication
logSys.debug("Starting communication")
try:
Expand Down

0 comments on commit b174a2e

Please sign in to comment.