Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Before using, home directory references must be modified to match invoking user.
- # Additionally, run touch on ~/.ip-cache prior to first run to avoid issues.
- cache='/home/rossiter/.ip-cache'
- prev=`/bin/cat $cache`
- current=`/usr/bin/wget -qO- http://ipecho.net/plain`
- # trap possible wget error
- if [ $? != 0 ]; then
- exit 1;
- fi
- # new IP found
- if [ "$current" != "$prev" ]; then
- /home/rossiter/bin/sms 12104584011 "$current"
- # SMS was successfully delivered to Google Voice
- # (impossible to determine whether SMS was delivered to phone)
- if [ $? -eq 0 ]; then
- /bin/echo "$current" > "$cache"
- exit 0
- # SMS send failed
- else
- exit 1;
- fi
- # old IP still present
- else
- exit 0;
- fi
Advertisement
Add Comment
Please, Sign In to add comment