diff --git a/pandora_agents/unix/plugins/autodiscover b/pandora_agents/unix/plugins/autodiscover index c47b17c275..8db10ac5b1 100644 --- a/pandora_agents/unix/plugins/autodiscover +++ b/pandora_agents/unix/plugins/autodiscover @@ -22,12 +22,23 @@ try: from subprocess import PIPE from subprocess import DEVNULL from subprocess import getstatusoutput + import signal except ModuleNotFoundError as err: print("{} error: {}. Exiting...".format(argv[0], err), file=stderr) exit(1) module_list = [] -VERSION = "1.2" +VERSION = "1.3" + +# Define a function to handle the SIGTERM signal +def sigterm_handler(signum, frame): + print("Received SIGTERM signal. Cleaning up...") + # Perform any necessary cleanup or shutdown operations here + # ... + + # Exit the script + sys.exit(0) +signal.signal(signal.SIGTERM, sigterm_handler) def win_service(servicelist, option=False, memcpu=False):