added sigterm handler

This commit is contained in:
Kevin 2024-04-16 14:23:04 +02:00
parent e1e129d962
commit 2093185b2c
1 changed files with 12 additions and 1 deletions

View File

@ -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):