Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.4: An AppleScript to help maintain AirPort connections' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: An AppleScript to help maintain AirPort connections
Authored by: charlesa on Jul 24, '06 01:30:17PM

It seems to me that there ought to be a way to do this entirely within a shell script (and by that I mean not using an osascript call).

Hmmm, Searching.....

Here's an ifconfig-based hint: Enable and disable Airport from the command line.

So, perhaps (untested)


#!/bin/sh

EXIT_CODE=`ping -c 1 -t 4 4.2.2.1 > /dev/null; echo $?`

if [ $EXIT_CODE -ne 0 ]
then
  ifconfig en1 down
  sleep 5
  ifconfig en 1 up
fi
Save as a shell script and run periodically by a root cron job (er, launchd task). Actually, it may be worthwhile to base the test on something like ifconfig en1 | grep inet instead of ping(8).

[ Reply to This | # ]