Closes issue #23
This commit is contained in:
parent
48abfbba8c
commit
7086eeac1b
1 changed files with 12 additions and 2 deletions
14
main.py
14
main.py
|
@ -31,6 +31,7 @@ import requests
|
|||
import threading
|
||||
import signal
|
||||
import socket
|
||||
import sys
|
||||
from functools import partial
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from bs4 import BeautifulSoup
|
||||
|
@ -199,8 +200,17 @@ def logURLLog(hostname, logTime, url, responseTime):
|
|||
|
||||
def main():
|
||||
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
if sys.platform.startswith('win'):
|
||||
|
||||
import win32api
|
||||
|
||||
win32api.SetConsoleCtrlHandler(lambda sig, frame:
|
||||
|
||||
signal_handler(signal.CTRL_C_EVENT, frame), True)
|
||||
else:
|
||||
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
|
||||
hostMonitorThread = threading.Thread(target=monitorHost, args=(stop_event,))
|
||||
urlMonitorThread = threading.Thread(target=monitorUrls, args=(stop_event,))
|
||||
|
|
Loading…
Reference in a new issue