// IP Address Regex http://www.regular-expressions.info/examples.html
currentIp = (
"http://whatsmyip.us/"
.toURL().text =~ /\b\d{
1
,
3
}\.\d{
1
,
3
}\.\d{
1
,
3
}\.\d{
1
,
3
}\b/)[
0
]
println
currentIp
def
ipLog =
new
File(
"ip-log.txt"
)
recentIp = ipLog.readLines().last().
tokenize
(
","
).last().trim()
if
(currentIp != recentIp) {
Mailer.deliverIpAddressChangeMessage currentIp
println
"IP Address has changed, it is now: ${currentIp}. Sending Message."