From a77711deb65ed5817644b830dc7794d85de22387 Mon Sep 17 00:00:00 2001 From: Cyril Jaquier Date: Sun, 3 Dec 2006 22:01:18 +0000 Subject: [PATCH] - 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-b1dcaea8d605 --- fail2ban-client | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/fail2ban-client b/fail2ban-client index 0cc9112e..dbb84616 100755 --- a/fail2ban-client +++ b/fail2ban-client @@ -201,20 +201,19 @@ class Fail2banClient: # Start the Fail2ban server in daemon mode. def __startServerAsync(self, socket, force = False): - args = list() - - args.append("fail2ban-server") - # Start in background mode. - args.append("-b") - # Set the socket path. - args.append("-s") - args.append(socket) - # Force the execution if needed. - if force: - args.append("-x") - print args + # Forks the current process. pid = os.fork() if pid == 0: + args = list() + args.append("fail2ban-server") + # Start in background mode. + args.append("-b") + # Set the socket path. + args.append("-s") + args.append(socket) + # Force the execution if needed. + if force: + args.append("-x") 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):