Hello,
I'm fairly new to Linux and have managed to make this script below work. Basically it gets my current external ip and emails it to me. It works great as a cron job daily but I was wondering if some of you guru's may be able to augment this script to ONLY email me when the external IP changes...(maybe put the current one in a variable then compare it to one in a file if they are the same do nothing if not email me the new and update the one in the file) I dunno some logic like that....anyone willing to take on this task because i"m stumped!!
************************************************** ***********************************************
#!/bin/bash
# cmd variables
SED=`which sed`
CURL=`which curl`
# the URL that will return your current IP address
CHECKIP='checkip.dyndns.com'
# email details
EMAIL='myemailaddy@myisp.com'
SUBJ='Current IP Address'
# get the current IP address
IP1=`$CURL -# $CHECKIP | sed -nr 's,^.*: ,,;s,<.*$,,p'`
# email the current IP address
echo "Your current IP address is $IP1." | mail -s "$SUBJ" "$EMAIL"
************************************************** ***********************************************