Skip to content

Instantly share code, notes, and snippets.

@0xbepresent
Last active December 24, 2015 10:29
Show Gist options
  • Save 0xbepresent/6784330 to your computer and use it in GitHub Desktop.
Save 0xbepresent/6784330 to your computer and use it in GitHub Desktop.
PIng to my server!
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