mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-06-23 18:18:38 +02:00
script-updates: use $LogAndPut
This commit is contained in:
parent
312caf3f90
commit
d516b1b249
1 changed files with 7 additions and 6 deletions
|
@ -15,6 +15,7 @@
|
|||
:global ScriptUpdatesIgnore;
|
||||
|
||||
:global SendNotification;
|
||||
:global LogAndPut;
|
||||
|
||||
:foreach Script in=[ / system script find where source~"^#!rsc" ] do={
|
||||
:local Ignore 0;
|
||||
|
@ -29,14 +30,14 @@
|
|||
:foreach Scheduler in=[ / system scheduler find where on-event~("\\b" . $ScriptVal->"name" . "\\b") ] do={
|
||||
:local SchedulerVal [ / system scheduler get $Scheduler ];
|
||||
:if ($ScriptVal->"policy" != $SchedulerVal->"policy") do={
|
||||
:log warning ("Policies differ for script " . $ScriptVal->"name" . \
|
||||
$LogAndPut warning ("Policies differ for script " . $ScriptVal->"name" . \
|
||||
" and its scheduler " . $SchedulerVal->"name" . "!");
|
||||
}
|
||||
:if ($SchedulerVal->"name" != "global-scripts" && \
|
||||
$SchedulerVal->"start-time" = "startup" && \
|
||||
$SchedulerVal->"interval" = 0s && \
|
||||
[ :pick ($SchedulerVal->"on-event") 0 7 ] != ":delay ") do={
|
||||
:log warning ("Scheduler " . $SchedulerVal->"name" . " starts on startup, " . \
|
||||
$LogAndPut warning ("Scheduler " . $SchedulerVal->"name" . " starts on startup, " . \
|
||||
"without interval. Add delay to make sure the configuration is available!");
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +57,7 @@
|
|||
:set SourceNew ($Result->"data");
|
||||
}
|
||||
} on-error={
|
||||
:log info ("Failed fetching " . $ScriptVal->"name");
|
||||
$LogAndPut warning ("Failed fetching " . $ScriptVal->"name");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +67,7 @@
|
|||
:if ($SourceNew != $ScriptVal->"source") do={
|
||||
:local DontRequirePermissions \
|
||||
($SourceNew~"\n# requires: dont-require-permissions=yes\n");
|
||||
:log info ("Updating script: " . $ScriptVal->"name");
|
||||
$LogAndPut info ("Updating script: " . $ScriptVal->"name");
|
||||
/ system script set owner=($ScriptVal->"name") source=$SourceNew \
|
||||
dont-require-permissions=$DontRequirePermissions $Script;
|
||||
:if ($ScriptVal->"name" = "global-config" && \
|
||||
|
@ -80,7 +81,7 @@
|
|||
:log debug ("Script " . $ScriptVal->"name" . " did not change.");
|
||||
}
|
||||
} else={
|
||||
:log warning ("Looks like new script " . $ScriptVal->"name" . " is not valid. Ignoring!");
|
||||
$LogAndPut warning ("Looks like new script " . $ScriptVal->"name" . " is not valid. Ignoring!");
|
||||
}
|
||||
} else={
|
||||
:log debug ("No update for script " . $ScriptVal->"name" . ".");
|
||||
|
@ -116,7 +117,7 @@
|
|||
}
|
||||
:set GlobalConfigChanges;
|
||||
} on-error={
|
||||
:log info ("Failed fetching changes!");
|
||||
$LogAndPut warning ("Failed fetching changes!");
|
||||
:set NotificationMessage ($NotificationMessage . \
|
||||
"\n\nChanges are not available.");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue