I need to check a website for changes to its IP address.
If the address has changed, I need to update the existing firewall rule, replacing the previous value with the new address.
The script can be run through a scheduled cron job.
So, here's how I see it:
1) When running the script, read the IP address from the existing ipfw rule:
2) Check if the site's current IP address has changed:
3) If the IP address from the check hasn't changed, terminate the script.
4) If the IP address changed during the host check and doesn't match XXX.XXX.XXX.YYY, execute:
If anyone uses a similar ready-made script, I'd be happy to help with the implementation.
Perhaps there is a simpler standard solution to the problem?
If the address has changed, I need to update the existing firewall rule, replacing the previous value with the new address.
The script can be run through a scheduled cron job.
So, here's how I see it:
1) When running the script, read the IP address from the existing ipfw rule:
ipfw show | grep 12000
12000 175 46077 allow ip from any to XXX.XXX.XXX.YYY keep-state :default
2) Check if the site's current IP address has changed:
host site.lovechange.com
site.lovechange.com is an alias for s1000x.cdn.ngenix.net.
s1000x.cdn.ngenix.net has the address XXX.XXX.XXX.YYY
3) If the IP address from the check hasn't changed, terminate the script.
4) If the IP address changed during the host check and doesn't match XXX.XXX.XXX.YYY, execute:
ipfw delete 12000
ipfw add 12000 allow ip from any to XXX.XXX.XXX.YYY
If anyone uses a similar ready-made script, I'd be happy to help with the implementation.
Perhaps there is a simpler standard solution to the problem?