Last active
November 19, 2015 04:35
-
-
Save Fuzzwah/0b8733affd490984626c to your computer and use it in GitHub Desktop.
Notify My Android on IP Change
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/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