Skip to content

Commit

Permalink
Update generate.py
Browse files Browse the repository at this point in the history
  • Loading branch information
endail authored Jun 26, 2024
1 parent 9728661 commit 2f08945
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions scripts/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@
for endpoint in server["endpoints"]:
print("Checking " + endpoint + "...")

result = subprocess.run(["nslookup", endpoint, "1.1.1.1"], capture_output=True, text=True, timeout=5)
print("DNS: " + "OK" if result.returncode == 0 else "Fail")

try:
result = subprocess.run(["nslookup", endpoint, "1.1.1.1"], capture_output=True, text=True, timeout=5)
print("DNS: " + "OK" if result.returncode == 0 else "Fail")
except TimeoutExpired:
print("Timeout")

if result.returncode != 0:
continue

result = subprocess.run(["ntpdig", "-j", "-t 5", endpoint], capture_output=True, text=True, timeout=5)
print("ntpdig success?: " + "Yes" if result.returncode == 0 else "No")

try:
result = subprocess.run(["ntpdig", "-j", "-t 5", endpoint], capture_output=True, text=True, timeout=5)
print("ntpdig success?: " + "Yes" if result.returncode == 0 else "No")
except TimeoutExpired:
print("Timeout")

if result.returncode != 0:
continue

Expand Down

0 comments on commit 2f08945

Please sign in to comment.