From 829cd4144cc2f504fce55d93549313375681177a Mon Sep 17 00:00:00 2001 From: Eliezer Croitoru Date: Sun, 31 Mar 2024 23:48:30 +0300 Subject: [PATCH] 4 --- updateIpCloudIfNotUpToDate.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 updateIpCloudIfNotUpToDate.txt diff --git a/updateIpCloudIfNotUpToDate.txt b/updateIpCloudIfNotUpToDate.txt new file mode 100644 index 0000000..8f17d4a --- /dev/null +++ b/updateIpCloudIfNotUpToDate.txt @@ -0,0 +1,19 @@ +{ + do { + #get current external IP + :local currentIP [:resolve myip.opendns.com server=resolver1.opendns.com]; + :local resolvedIP; + + # Determine if DNS update is needed + :if ($currentIP != $resolvedIP) do={ + :log info "Mynetname update needed: Current-IP: $currentIP Resolved-IP: $resolvedIP"; + /ip/cloud/force-update; + :local resolvedIP [:resolve myip.opendns.com server=resolver1.opendns.com]; + } else={ + :local resolvedIP [:resolve myip.opendns.com server=resolver1.opendns.com]; + #:log info "Mynetname: No update needed $currentIP equals $resolvedIP"; + } + } on-error={ + :log info "Error force-update"; + } +}