Skip to content

Instantly share code, notes, and snippets.

@Fuzzwah
Last active November 19, 2015 04:35
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 Fuzzwah/0b8733affd490984626c to your computer and use it in GitHub Desktop.
Save Fuzzwah/0b8733affd490984626c to your computer and use it in GitHub Desktop.
Notify My Android on IP Change
#!/bin/bash
OLD_IP='cat ip.txt'
NEW_IP=$(/sbin/ifconfig wlan2 | awk 'match($0,/addr:[0-9\.]+/) {print substr($0,RSTART+5,RLENGTH-5)}')
if [ $NEW_IP != $OLD_IP ]; then
nma_cli -A <NMA API KEY HERE> notify -a "Wicking Digital Signage" -e "IP Change" -m "New IP: $NEW_IP"
fi
echo $NEW_IP > ip.txt
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment