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

Click here to return to the 'Keep attempting reconnection to wireless network' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Keep attempting reconnection to wireless network
Authored by: joostjodel on Feb 24, '11 02:41:52PM

Thanks for this command.
To make it make useful for my purposes, that is, trying to reconnect an old Powerbook server that regularly loses its WiFi connection, I cobbled together a few extras:

1. a bash script that can be invoked to check if Airport is still up

## simple script to check whether Airport is still up, and restart it in case it is down.
if ping -W2 -c4
then echo "Hurrah, still up in the air…"
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport prefs joinmode=automatic joinmodefallback=keeplooking

This pings to your router (mine is on - change if appropriate) and runs the command if no network is up.

I placed this as "" in /usr/local/bin/ (don't forget to run a $chmod 770)

2. run the command visudo and add a few lines under:

# Cmnd alias specification
Cmnd_Alias AIRPORT = /usr/local/bin/

and under:

# User privilege specification
<your usename here> ALL=AIRPORT

3. make a launchd script "local.airport_up_check.plist" with the following content and place it in /Library/LaunchAgents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<true />

600 means run every 10 minutes (10*60 secs).

then run the command:
$ launchctl load /Library/LaunchAgents/local.airport_up_check.plist

[ Reply to This | # ]