From 69ab2f58cac33909cbd8c7947667cc005fb45e2b Mon Sep 17 00:00:00 2001 From: Grzegorz Budny Date: Mon, 14 Oct 2019 20:49:16 +0200 Subject: [PATCH] Update --- RouterOS_Auto_Upgrade.rsc | 5 +++++ RouterOS_Script_Fetch.rsc | 36 ++++++++++++++++++++---------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/RouterOS_Auto_Upgrade.rsc b/RouterOS_Auto_Upgrade.rsc index 6b19a1c..4863d03 100644 --- a/RouterOS_Auto_Upgrade.rsc +++ b/RouterOS_Auto_Upgrade.rsc @@ -32,6 +32,11 @@ :log info ("...:::No updates found. ".$packageCurrent." is the latest version...:::"); + /tool e-mail send server=$smtpServer port=$smtpPort from=($systemName.$domain) \ + to=$recipient subject=("No update available on ".$systemName) \ + body=($systemName." has installed the latest package ".$packageLatest); + + } } diff --git a/RouterOS_Script_Fetch.rsc b/RouterOS_Script_Fetch.rsc index 66c2b34..732d990 100644 --- a/RouterOS_Script_Fetch.rsc +++ b/RouterOS_Script_Fetch.rsc @@ -4,28 +4,32 @@ :global FetchScript do={ - tool fetch mode=https http-method=get url=$url dst-path=($destinationPath."/".$destinationFileName); + :foreach url,destinationFileName in=$urls do={ - :if($isRun)do={ + /tool fetch mode=https http-method=get url=$url dst-path=($destinationPath."/".$destinationFileName); + :log info "...:::Scripts fetched:::..."; - /system script run ($destinationPath.$destinationFileName); + :if ($isRun) do={ - } - :if($isSchedule)do={ + /system script run ($destinationPath.$destinationFileName); + :log info "...:::Script loaded to environment:::..."; - /system scheduler \ - add interval=($interval.h) name=$taskName on-event=("system script run ".($destinationPath."/".$destinationFileName)) \ - policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ - start-date=jan/01/1970 start-time=$startTime; + } + :if ($isSchedule) do={ + /system scheduler \ + add interval=($interval.h) name=$taskName on-event=("system script run ".($destinationPath."/".$destinationFileName)) \ + policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ + start-date=jan/01/1970 start-time=$startTime; + :log info "...:::Script joined to scheduler:::..."; + + } } } -#$FetchScript url="https://example.repo.com" destinationPath="FolderName" destinationFileName="ScriptName" - -#$FetchScript url="https://example.repo.com" destinationPath="FolderName" destinationFileName="ScriptName" isRun=true - -#$FetchScript url="https://example.repo.com" destinationPath="FolderName" destinationFileName="ScriptName" isSchedule=true\ -#interval="24" taskName="TaskName" startTime="startup" - +#Example +:global urlsBase {"URL1"="script1"; \ + "URL2"="script2" \ + }; +$FetchScript urls=$urlsBase destinationPath="destinationPath" destinationFileName=$urlsBase; \ No newline at end of file