Skip to content

Instantly share code, notes, and snippets.

@maksymx
Last active August 29, 2015 13:57
Show Gist options
  • Save maksymx/9645050 to your computer and use it in GitHub Desktop.
Save maksymx/9645050 to your computer and use it in GitHub Desktop.
Ping from python stdlibs
import os
hostname = "google.com" #example
response = os.system("ping -c 1 " + hostname)
#and then check the response...
if response == 0:
print hostname, 'is up!'
else:
print hostname, 'is down!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment