mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
global-functions: add $ScriptInstallUpdate
Just call without parameters to update scripts: [admin@MikroTik] > $InstallAndUpdate Add comma separated list of scripts to install and update: [admin@MikroTik] > $InstallAndUpdate cloud-backup[,upload-backup][,...]
This commit is contained in:
@ -32,6 +32,7 @@
|
||||
:global GetRandom;
|
||||
:global RandomDelay;
|
||||
:global DeviceInfo;
|
||||
:global ScriptInstallUpdate;
|
||||
|
||||
# url encoding
|
||||
:set UrlEncode do={
|
||||
@ -412,3 +413,16 @@
|
||||
|
||||
:return $Info;
|
||||
}
|
||||
|
||||
# install new scripts, update existing scripts
|
||||
:set ScriptInstallUpdate do={
|
||||
:local Scripts [ :toarray $1 ];
|
||||
|
||||
:foreach Script in=$Scripts do={
|
||||
:if ([ / system script print count-only where name=$Script ] = 0) do={
|
||||
:log info ("Adding new script: " . $Script);
|
||||
/ system script add name=$Script source="#!rsc";
|
||||
}
|
||||
}
|
||||
/ system script run script-updates;
|
||||
}
|
||||
|
Reference in New Issue
Block a user