Created
September 24, 2014 20:00
-
-
Save bobbzorzen/a1c229d97daf329eeb78 to your computer and use it in GitHub Desktop.
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 | |
function child() | |
{ | |
while true; do | |
filename='currentip.txt' | |
oldIp=`cat $filename` | |
currentIp=`curl http://bot.whatismyipaddress.com/` | |
if [ $oldIp != $currentIp ] | |
then | |
echo "$(date)\tIp address has changed, sending mail. (Old: $oldIp | New: $currentIp)" >> mailerlog.log | |
php sendMailTest.php $currentIp | |
echo $currentIp > $filename | |
fi | |
sleep 12h | |
done | |
} | |
child& | |
kill $$ #Kill parent and leave child running | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment