I found a bit of example code (below) but keep getting the following error
&& echo Exit status: $? && exit 1
Could really use some help, needs to be up soon and this looks to the best solution I've found.
many thanks your insight - ben
#! /usr/bin/python import os import time import logging CHECK_PERIOD_IN_SECONDS = 60 TEMPFILE = "connection-info.txt" KEYWORD = "MyPlace" LOGFILE = "airport-reconnect.log" def is_connected(): # Generate connection info os.system("/usr/sbin/airport -I >" + TEMPFILE) # Read connection info f = open(TEMPFILE, "r") data = f.read() f.close() # Check return KEYWORD in data def connect(): os.system("/usr/sbin/airport -a") logging.info("Re-connected.") if __name__ == "__main__": # Logger try: os.remove(LOGFILE) except: pass logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-8s %(message)s', filename=LOGFILE, filemode='w') # Loop while True: if not is_connected(): connect() time.sleep(CHECK_PERIOD_IN_SECONDS)
This post has been edited by orionrush: 18 September 2008 - 11:57 AM