Skip to content

Instantly share code, notes, and snippets.

@Algogator
Created September 26, 2015 16:19
Show Gist options
  • Save Algogator/b5fb45a083d5f0bcf42c to your computer and use it in GitHub Desktop.
Save Algogator/b5fb45a083d5f0bcf42c to your computer and use it in GitHub Desktop.
#!/bin/bash
#http://askubuntu.com/questions/16143/is-there-a-way-to-start-a-bash-script-after-boot-only-when-wlan0-is-connected
while true
do
nmcli -t -f DEVICE,STATE dev | grep -q "^wlan0:connected$"
if [ $? -eq 0 ]; then
break
else
sleep 60
fi
done
curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//' | mail -s "IP Address" "philipskd@gmail.com,philipskd@yahoo.com,anna.cs.au@gmail.com"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment