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__()
|
||||
|
||||
def monitor():
|
||||
last_was_fail: bool = False
|
||||
while True:
|
||||
try:
|
||||
b, msg = check_net()
|
||||
if not b:
|
||||
print(f":FAILURE AT {datetime.now()}:")
|
||||
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)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
|
Loading…
Reference in New Issue