diff --git a/fail2ban-client b/fail2ban-client
index 8b8a2919..ec8b315d 100755
--- a/fail2ban-client
+++ b/fail2ban-client
@@ -61,15 +61,35 @@ class Fail2banClient:
print "Fail2Ban v" + version + " reads log file that contains password failure report"
print "and bans the corresponding IP addresses using firewall rules."
print
- print " -c
configuration directory"
- print " -d dump configuration"
- print " -v increase verbosity"
- print " -q decrease verbosity"
- print " -x force execution of the server"
- print " -h display this help message"
+ print " "
+ print
+ print " start start the server and the jails"
+ print " reload reload the configuration"
+ print " stop stop all jails and terminate the server"
+ print " status get the current status"
+ print
+ print " set loglevel set loglevel to "
+ print " get loglevel get loglevel"
+ print " set logtarget set log target to "
+ print " get logtarget get log target"
+ print
+ print " add create "
+ print " set set the value for "
+ print " get get the value for "
+ print " start start "
+ print " stop stop . The jail is removed"
+ print " status get the current status of "
+ print
+ print " [OPTIONS]"
+ print
+ print " -c configuration directory"
+ print " -d dump configuration. For debugging"
+ print " -v increase verbosity"
+ print " -q decrease verbosity"
+ print " -x force execution of the server"
+ print " -h display this help message"
print
print "Report bugs to "
- sys.exit(0)
def getCmdLineOptions(self, optList):
""" Gets the command line options
@@ -85,6 +105,7 @@ class Fail2banClient:
self.conf["force"] = True
elif opt[0] in ["-h", "--help"]:
self.dispUsage()
+ sys.exit(0)
def ping(self):
return self.processCmd([["ping"]], False)
@@ -123,6 +144,7 @@ class Fail2banClient:
if len(sys.argv) < 2:
self.dispUsage()
+ return False
if len(cmd) == 1 and cmd[0] == "start":
if self.ping():
@@ -146,9 +168,10 @@ class Fail2banClient:
self.readConfig()
self.processCmd(['stop', 'all'], False)
# Configure the server
- self.processCmd(self.stream, False)
+ return self.processCmd(self.stream, False)
else:
logSys.error("Could not find server")
+ return False
else:
return self.processCmd([cmd])
@@ -212,7 +235,7 @@ class Fail2banClient:
stdout.setFormatter(formatter)
logSys.addHandler(stdout)
- self.processCommand(args)
+ return self.processCommand(args)
def readConfig(self):
# Read the configuration
@@ -235,4 +258,9 @@ class ServerExecutionException(Exception):
if __name__ == "__main__":
client = Fail2banClient()
- client.start(sys.argv)
+ # Exit with correct return value
+ if client.start(sys.argv):
+ sys.exit(0)
+ else:
+ sys.exit(-1)
+