added sigterm handler
This commit is contained in:
parent
e1e129d962
commit
2093185b2c
|
@ -22,12 +22,23 @@ try:
|
||||||
from subprocess import PIPE
|
from subprocess import PIPE
|
||||||
from subprocess import DEVNULL
|
from subprocess import DEVNULL
|
||||||
from subprocess import getstatusoutput
|
from subprocess import getstatusoutput
|
||||||
|
import signal
|
||||||
except ModuleNotFoundError as err:
|
except ModuleNotFoundError as err:
|
||||||
print("{} error: {}. Exiting...".format(argv[0], err), file=stderr)
|
print("{} error: {}. Exiting...".format(argv[0], err), file=stderr)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
module_list = []
|
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):
|
def win_service(servicelist, option=False, memcpu=False):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue