#Aggiornamento Automatico dell'host di NO-IP #creare lo script con il nome NO-IP_DDNS #--------------- Definire i parametri per la configurazione dell'account di NO-IP---------------- # informazioni di accesso a NO-IP :local noipuser "XXXXXXXX" :local noippass "XXXXXXXX" # Imposta il nome del server web per aggiornare l'IP. # Il nome del server non accetta spazi. Sostituisci il valore tra virgolette con il nome (URL) del tuo server. # Per specificare più server, separarli con virgole. :local noiphost "XXXXXXXX" :global previousIP #---------------------------------------- #inserire il nome dello scheduler :local scheduleName "NO-IP_Update" #---------------------------------------- #inserire qui ogni qunto tempo eseguire lo script :local myRunTime 300s #---------------------------------------- #--------------Crea lo scheduler con partenza ogni 5 minuti------------------------- :if ([:len [/system scheduler find name="$scheduleName"]] = 0) do={ /log warning "[LogFilter] Alert : lo Scheduler non esiste. Creo lo scheduler" /system scheduler add name=$scheduleName interval=$myRunTime start-date=Jan/01/1970 start-time=startup on-event="NO-IP_DDNS" /log warning "[LogFilter] Alert : Scheduler creato ." } /tool fetch url="http://myip.dnsomatic.com/" mode=http dst-path=mypublicip.txt :local currentIP [file get mypublicip.txt contents] # Strip the net mask off the IP address :for i from=( [:len $currentIP] - 1) to=0 do={ :if ( [:pick $currentIP $i] = "/") do={ :set currentIP [:pick $currentIP 0 $i] } } :if ($currentIP != $previousIP) do={ :log info "No-IP: O ip atual $currentIP non è uguale a quello precedente,aggiornamento necessario" :set previousIP $currentIP # The update URL. Note the "\3F" is hex for question mark (?). Required since ? is a special character in commands. :local url "http://dynupdate.no-ip.com/nic/update\3Fmyip=$currentIP" :local noiphostarray :set noiphostarray [:toarray $noiphost] :foreach host in=$noiphostarray do={ :log info "No-IP: Sending update for $host" /tool fetch url=($url . "&hostname=$host") user=$noipuser password=$noippass mode=http dst-path=("no-ip_ddns_update-" . $host . ".txt") :log info "No-IP: l'host $host è stato aggiornato con il seguente IP $currentIP" } } else={ :log info "No-IP: IP precedente $previousIP é uguale all'IP attuale, nessun aggiornamento necessario." }