Script for Email Notification of IP Address Change
Posted: Wed Oct 28, 2015 8:41 am
I had an issue where my DynDNS updater did not update a new IP address provided by my ISP. So as a backup I came up with this script that I embedded in a scheduled task that runs every hour. It checks my IP Address and if it is different than the current one , stored in an Indigo variable "IPAddress", I email myself the new address. Then I can manually change the IP Address at DynDNS and all will be good.
I hope this helps someone!
Ara Derderian
HDTV and Home Theater Podcast
http://www.htguys.com
I hope this helps someone!
Ara Derderian
HDTV and Home Theater Podcast
http://www.htguys.com
- Code: Select all
set recipientName to "YourName"
set recipientAddress to "youraddress@yourmailprovider.com"
set theSubject to "IP Address Changed"
set newIPAddress to word 25 of (do shell script "/usr/bin/curl checkip.dyndns.org")
if the value of variable "IPAddress" is not equal to newIPAddress then
set the value of variable "IPAddress" to newIPAddress
tell application "Mail"
##Create the message
set theMessage to make new outgoing message with properties {subject:theSubject, content: newIPAddress, visible:true}
##Set a recipient
tell theMessage
make new to recipient with properties {name:recipientName, address:recipientAddress}
##Send the Message
send
end tell
end tell
end if