From feb039011dcf50b84bb23acb86e0524c6912246e Mon Sep 17 00:00:00 2001 From: Grzegorz Budny Date: Wed, 21 Aug 2019 14:22:27 +0200 Subject: [PATCH] Initial Commit. --- RouterOS_Script_Fetch.rsc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 RouterOS_Script_Fetch.rsc diff --git a/RouterOS_Script_Fetch.rsc b/RouterOS_Script_Fetch.rsc new file mode 100644 index 0000000..66c2b34 --- /dev/null +++ b/RouterOS_Script_Fetch.rsc @@ -0,0 +1,31 @@ +# RouterOS Function +# Copyright (c) Grzegorz Budny +# Fetches RouterOS script from external https location and runs it or creates schedule task + +:global FetchScript do={ + + tool fetch mode=https http-method=get url=$url dst-path=($destinationPath."/".$destinationFileName); + + :if($isRun)do={ + + /system script run ($destinationPath.$destinationFileName); + + } + :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; + + } +} + +#$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" + +