Skip to content

Commit

Permalink
2.0
Browse files Browse the repository at this point in the history
Now, you don't need to count on your own how many hosts you have.
+Script optimizations.
Special thanks to @ablaziak.
  • Loading branch information
JulianKorgol committed Oct 20, 2021
1 parent 8594d26 commit 97f9303
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import os
numberOfHosts = 1 #Enter the number of hosts would you like to ping.
Hosts = [] #Enter your hosts in the list.
hosts = [""] #Enter your hosts in the list.
print("Script for checking that servers are working.")
print("Author: Julian Korgol.")
print("https://juliankorgol.com/")
n = 0
numberOfHosts = len(hosts)
while n < numberOfHosts:
answer = os.system("ping " +Hosts[n])
answer = os.system("ping " +hosts[n])
if answer == 0:
print(Hosts[n] + "\033[92m" + " It's working!")
n += 1
print(hosts[n] + "\033[92m" + " It's working!")
else:
print(Hosts[n] + "\033[91m" + " It's down!")
n += 1
print(hosts[n] + "\033[91m" + " It's down!")
n += 1
print("\033[0m")

0 comments on commit 97f9303

Please sign in to comment.