Last active
December 24, 2015 10:29
-
-
Save 0xbepresent/6784330 to your computer and use it in GitHub Desktop.
PIng to my server!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys | |
if __name__ == "__main__": | |
# python ping_my_server.py misalabs.com | |
hostname = sys.argv[1] if len(sys.argv) == 2 else "misalabs.com" | |
end = False | |
while end is False: | |
response = os.system("ping -c 1 " + hostname) | |
if response == 0: | |
print "%s is up!" % hostname | |
end = True | |
else: | |
print "%s is down!" % hostname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment