Same thing for _httpd.py

This commit is contained in:
2024-07-04 18:45:33 +02:00
parent 913ab3531d
commit 4f4c2dcdac

View File

@ -123,7 +123,7 @@ def main():
config_section = 'httpd'
config = configparser.ConfigParser()
parser = argparse.ArgumentParser(exit_on_error=False)
parser = argparse.ArgumentParser(exit_on_error=False, add_help=False)
parser.add_argument('-c', '--config', help='config file to load')
parser.add_argument('-d', '--debug', action='store_true', help='enable debug')
@ -166,10 +166,21 @@ def main():
help='port to bind to',
type=int,
default=config[config_section]['port'])
parser.add_argument(
'-h',
'--help',
help='show this help and exit',
action='store_true',
default=False)
args = parser.parse_args()
logging.debug(args)
if args.help:
parser.print_help()
sys.exit()
if not os.path.isfile(args.vardir + 'routerstats.rrd'):
logging.error('Cannot find rrd file %s', args.vardir + 'routerstats.rrd' )
sys.exit()