Added force stop
This commit is contained in:
parent
e396cf51f1
commit
c425b973a0
8
main.py
8
main.py
@ -135,7 +135,12 @@ def v1():
|
|||||||
PingRequester('192.168.2.1', 'data/192-168-2-1.csv')
|
PingRequester('192.168.2.1', 'data/192-168-2-1.csv')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
sig_received = False
|
||||||
|
|
||||||
def stop(sig, frame):
|
def stop(sig, frame):
|
||||||
|
if sig_received:
|
||||||
|
exit(1)
|
||||||
|
|
||||||
print("Stopping threads gratefully (may take up to 60 seconds)")
|
print("Stopping threads gratefully (may take up to 60 seconds)")
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
thread.finish()
|
thread.finish()
|
||||||
@ -155,6 +160,9 @@ def v2():
|
|||||||
'1.1.1.1', '217.237.148.22', '192.168.2.1')
|
'1.1.1.1', '217.237.148.22', '192.168.2.1')
|
||||||
|
|
||||||
def stop(sig, frame):
|
def stop(sig, frame):
|
||||||
|
if ping.stop:
|
||||||
|
exit(1)
|
||||||
|
|
||||||
print("Stopping process gratefully (may take up to 60 seconds)")
|
print("Stopping process gratefully (may take up to 60 seconds)")
|
||||||
ping.finish()
|
ping.finish()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user