•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 397,612 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,529 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser:
Views: 1267 | Replies: 2
![]() |
•
•
Join Date: Jun 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
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"
************************************************** ***********************************************
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"
************************************************** ***********************************************
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
advertisment animations browser cell email encryption eu eudora firefox flash gmail google imap interactivity. microsoft mobile mozilla multimedia news onecare open source opinion outlook penelope phishing phones professional research scam scripting security spam spammers spamming stocks technology thunderbird virus web web development webmail
- Bash Mail script help (Shell Scripting)
- Will Pay $20 Paypal: Script Help ASAP (Shell Scripting)
- Get Email ID (Perl)
- Flash Pagerank Script HOT! (Websites for Sale)
- Not sending Feedback Form (PHP)
- JavaScript -- Validating an email address (JavaScript / DHTML / AJAX)
- need to strip stuff from email (Python)
Other Threads in the Shell Scripting Forum
- Previous Thread: Convert shell script for looping
- Next Thread: KSH Passing parameters that start with $


Linear Mode