mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04: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:
parent
352818ea48
commit
c500243c97
1 changed files with 14 additions and 0 deletions
|
@ -32,6 +32,7 @@
|
||||||
:global GetRandom;
|
:global GetRandom;
|
||||||
:global RandomDelay;
|
:global RandomDelay;
|
||||||
:global DeviceInfo;
|
:global DeviceInfo;
|
||||||
|
:global ScriptInstallUpdate;
|
||||||
|
|
||||||
# url encoding
|
# url encoding
|
||||||
:set UrlEncode do={
|
:set UrlEncode do={
|
||||||
|
@ -412,3 +413,16 @@
|
||||||
|
|
||||||
:return $Info;
|
: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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue