print success after fail
This commit is contained in:
parent
b90a32aad5
commit
7c195841cd
|
@ -31,12 +31,18 @@ def reachable(domain: str) -> tuple[bool, str]:
|
||||||
return False, e.__str__()
|
return False, e.__str__()
|
||||||
|
|
||||||
def monitor():
|
def monitor():
|
||||||
|
last_was_fail: bool = False
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
b, msg = check_net()
|
b, msg = check_net()
|
||||||
if not b:
|
if not b:
|
||||||
print(f":FAILURE AT {datetime.now()}:")
|
print(f":FAILURE AT {datetime.now()}:")
|
||||||
print(msg)
|
print(msg)
|
||||||
|
last_was_fail = True
|
||||||
|
elif b and last_was_fail:
|
||||||
|
print(f":SUCCESS AT {datetime.now()}:")
|
||||||
|
print(msg)
|
||||||
|
last_was_fail = False
|
||||||
sleep(SLEEPTIME)
|
sleep(SLEEPTIME)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
Loading…
Reference in New Issue