mirror of https://github.com/fail2ban/fail2ban
- Changed timeout to 30 secondes before assuming the server cannot be started
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@477 a942ae1a-1317-0410-a47c-b1dcaea8d6050.x
parent
159ecbc567
commit
a77711deb6
|
@ -201,8 +201,10 @@ class Fail2banClient:
|
|||
# Start the Fail2ban server in daemon mode.
|
||||
|
||||
def __startServerAsync(self, socket, force = False):
|
||||
# Forks the current process.
|
||||
pid = os.fork()
|
||||
if pid == 0:
|
||||
args = list()
|
||||
|
||||
args.append("fail2ban-server")
|
||||
# Start in background mode.
|
||||
args.append("-b")
|
||||
|
@ -212,9 +214,6 @@ class Fail2banClient:
|
|||
# Force the execution if needed.
|
||||
if force:
|
||||
args.append("-x")
|
||||
print args
|
||||
pid = os.fork()
|
||||
if pid == 0:
|
||||
try:
|
||||
# Use the PATH env
|
||||
os.execvp("fail2ban-server", args)
|
||||
|
@ -231,10 +230,11 @@ class Fail2banClient:
|
|||
# Wait for the server to start
|
||||
cnt = 0
|
||||
while not self.__ping():
|
||||
if cnt > 10:
|
||||
# The server has 30 secondes to start.
|
||||
if cnt >= 300:
|
||||
raise ServerExecutionException("Failed to start server")
|
||||
time.sleep(0.1)
|
||||
cnt = cnt + 1
|
||||
cnt += 1
|
||||
|
||||
|
||||
def start(self, argv):
|
||||
|
|
Loading…
Reference in New Issue