Skip to content

Instantly share code, notes, and snippets.

@greenbreakfast
Created June 30, 2020 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greenbreakfast/fd9484f4371efa3b8df307d06021dd69 to your computer and use it in GitHub Desktop.
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
#!/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