Skip to content

Instantly share code, notes, and snippets.

@kanokkorn
Created January 10, 2017 19:38
Show Gist options
  • Save kanokkorn/10d0b148da0d5a9d983af72bdb719d14 to your computer and use it in GitHub Desktop.
Save kanokkorn/10d0b148da0d5a9d983af72bdb719d14 to your computer and use it in GitHub Desktop.
basic RPi ping /w color
import time, os, colorama
from colorama import Fore, Back, Style
host = 'www.google.com'
colorama.init()
while True:
response = os.system('sudo ping -c 1 -W 1000' + host )
if response == 0:
print(Fore.GREEN + host +" is up ! " )
time.sleep(1)
else:
print(Fore.RED + host +" is down ! " )
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment