Created
June 30, 2020 15:12
-
-
Save greenbreakfast/fd9484f4371efa3b8df307d06021dd69 to your computer and use it in GitHub Desktop.
Omega2 USB Autorun script to connect to a WiFi network, wait until connected, and then do something that needs the internet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
printf "%s" "Connecting to WiFi" | |
wifisetup add -ssid Network-SSID -encr wpa2 -password XXXXXXXX | |
printf "%s" "Waiting for Internet" | |
while ! ping -c 1 -n -w 1 www.google.com &> /dev/null | |
do | |
printf "%c" "." | |
done | |
printf "\n%s\n" "Internet Connected" | |
# command that needs the internet | |
opkg update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment