From 3977f24766448dcd414de9428a7db57154890cfd Mon Sep 17 00:00:00 2001 From: Paul Hoffman Date: Sun, 10 Mar 2024 15:01:14 -0700 Subject: [PATCH 1/2] Add CLI option for PID file --- adns_server.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/adns_server.py b/adns_server.py index dc17632..108e01f 100755 --- a/adns_server.py +++ b/adns_server.py @@ -125,6 +125,7 @@ def usage(msg=None): -f: Remain attached to foreground (default don't) -e N: Max EDNS bufsize in octets for responses we send out. (-e 0 will disable EDNS support) + -x file: Name of file to write the PID Note: a configuration file that minimally specifies the zones to load must be present. @@ -250,6 +251,8 @@ def process_args(prefs, zonedict, arguments): prefs.daemon = False elif opt == "-e": prefs.edns_udp_max = int(optval) + elif opt == "-x": + prefs.pidfile = optval def log_message(msg): From dabe41461add45a0b89f18a32f808ebc5a379fb9 Mon Sep 17 00:00:00 2001 From: Paul Hoffman Date: Sun, 10 Mar 2024 15:05:22 -0700 Subject: [PATCH 2/2] Forgot how to use getopt --- adns_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adns_server.py b/adns_server.py index 108e01f..ad90481 100755 --- a/adns_server.py +++ b/adns_server.py @@ -214,7 +214,7 @@ def process_args(prefs, zonedict, arguments): """Process all command line arguments""" try: - (options, args) = getopt.getopt(arguments, 'hc:dp:s:z:u:g:46fe:') + (options, args) = getopt.getopt(arguments, 'hc:dp:s:z:u:g:46fe:x:') except getopt.GetoptError as error_info: usage(str(error_info))