Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Pull request Compare This branch is 9 commits behind TC2013:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
wifi.sh

README.md

Instructions:

Install where you want to run it from like /home/edison/src/edison_wifi

cd ~/src

git clone https://github.com/TC2013/edison_wifi

cd edison_wifi

chmod 0755 /home/edison/src/edison_wifi/wifi.sh

Using your editor (nano, vi, etc), change the pingip to be the address of your router (currently line 38)

Add to crontab using crontab -e

Run Every 5 mins - Seems like ever min is over kill unless this is a very common problem. If once a min change */5 to * once every 2 mins */5 to */2 ...

*/5 * * * * /home/edison/src/edison_wifi/wifi.sh

YOUR_HOME_NETWORK=ssid_name #change ssid_name to your primary network you want to use. This will switch to that network if it is available.

The following line is helpful in not having to enter your password to run commands:

sudo visudo and append edison ALL=(ALL) NOPASSWD: ALL at the end


This final crontab script is meant to automatically switch your pi/edison over to your home network (preferred network) if available. It isn't very reliable, but I'm keeping it in for now in case someone can figure out how to make it work more reliably.

You will need to run the following as sudo crontab -e

YOUR_HOME_NETWORK=ssid_name

*/15 * * * * ( (wpa_cli status | grep $YOUR_HOME_NETWORK > /dev/null && echo already on $YOUR_HOME_NETWORK) || (wpa_cli scan > /dev/null && wpa_cli scan_results | egrep $YOUR_HOME_NETWORK > /dev/null && wpa_cli select_network $(wpa_cli list_networks | grep $YOUR_HOME_NETWORK | cut -f 1) && echo switched to $YOUR_HOME_NETWORK && sleep 15 && (for i in $(wpa_cli list_networks | grep DISABLED | cut -f 1); do wpa_cli enable_network $i > /dev/null; done) && echo and re-enabled other networks) ) 2>&1 | logger -t wifi-select

You can’t perform that action at this time.