import os
import time
import phone_home

def gateway_ping():
    hostname = "<your default gateway>"
    interface = "wlan0"
    response = os.system("ping -c 4 -I " + interface + " " + hostname)

    if response == 0:
        status = 'Up'
        phone_home.interface_outage()
    else:
        status = 'Down'
        phone_home.network_outage()
    return status

def run():
    while(True):
        print(gateway_ping())
       # time.sleep(20)
