mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-02 01:04:55 +02:00
always write warnings and errors to log
This commit is contained in:
parent
27b2fffaaf
commit
b35c0b8a6f
10 changed files with 25 additions and 12 deletions
|
@ -30,6 +30,7 @@
|
|||
|
||||
:do {
|
||||
:if ([ :len $CertRenewUrl ] = 0) do={
|
||||
:log info "No CertRenewUrl given.";
|
||||
:error "No CertRenewUrl given.";
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
:if ([ / system package print count-only where name="wireless" disabled=no ] > 0) do={
|
||||
:if ([ / interface wireless cap get enabled ] = true && \
|
||||
[ / caps-man manager get enabled ] = false) do={
|
||||
:error "System is managed by CAPsMAN, not checking.";
|
||||
:log warning "System is managed by CAPsMAN, not checking.";
|
||||
:error "Warning: See log for details.";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,8 +65,9 @@
|
|||
}
|
||||
|
||||
:if ($SentRouterosUpdateNotification = $LatestVersion) do={
|
||||
:error ("Already sent the RouterOS update notification for version " . \
|
||||
:log info ("Already sent the RouterOS update notification for version " . \
|
||||
$LatestVersion . ".");
|
||||
:error "Already sent notification.";
|
||||
}
|
||||
|
||||
$SendNotification ("RouterOS update notification") \
|
||||
|
|
|
@ -16,7 +16,8 @@ $ScriptLock "collect-wireless-mac.capsman";
|
|||
|
||||
:local PlaceBefore [ / caps-man access-list find where comment="--- collected above ---" disabled ];
|
||||
:if ([ :len $PlaceBefore ] = 0) do={
|
||||
:error "Missing disabled access-list entry with comment '--- collected above ---'";
|
||||
:log error "Missing disabled access-list entry with comment '--- collected above ---'";
|
||||
:error "Error: See log for details.";
|
||||
}
|
||||
|
||||
:foreach RegTbl in=[ / caps-man registration-table find ] do={
|
||||
|
|
|
@ -16,7 +16,8 @@ $ScriptLock "collect-wireless-mac.local";
|
|||
|
||||
:local PlaceBefore [ / interface wireless access-list find where comment="--- collected above ---" disabled ];
|
||||
:if ([ :len $PlaceBefore ] = 0) do={
|
||||
:error "Missing disabled access-list entry with comment '--- collected above ---'";
|
||||
:log error "Missing disabled access-list entry with comment '--- collected above ---'";
|
||||
:error "Error: See log for details.";
|
||||
}
|
||||
|
||||
:foreach RegTbl in=[ / interface wireless registration-table find ] do={
|
||||
|
|
|
@ -17,7 +17,8 @@ $ScriptLock "collect-wireless-mac%TEMPL%";
|
|||
|
||||
:local PlaceBefore [ / %PATH% access-list find where comment="--- collected above ---" disabled ];
|
||||
:if ([ :len $PlaceBefore ] = 0) do={
|
||||
:error "Missing disabled access-list entry with comment '--- collected above ---'";
|
||||
:log error "Missing disabled access-list entry with comment '--- collected above ---'";
|
||||
:error "Error: See log for details.";
|
||||
}
|
||||
|
||||
:foreach RegTbl in=[ / %PATH% registration-table find ] do={
|
||||
|
|
|
@ -10,11 +10,13 @@
|
|||
/ system scheduler set interval=15s $Scheduler;
|
||||
} else={
|
||||
:if ([ / tool netwatch get [ find where comment=[ / tool e-mail get address ] ] status ] != "up") do={
|
||||
:error "Mail server is not up.";
|
||||
:log warning "Mail server is not up.";
|
||||
:error "Warning: See log for details.";
|
||||
}
|
||||
|
||||
:if ([ / system ntp client get status ] != "synchronized") do={
|
||||
:error "Time is not yet synchronized from ntp.";
|
||||
:log warning "Time is not yet synchronized from ntp.";
|
||||
:error "Warning: See log for details.";
|
||||
}
|
||||
|
||||
/ system script run [ find where name~"daily-psk\\.(capsman|local)" ];
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
:if ($BackupSendBinary != true && \
|
||||
$BackupSendExport != true && \
|
||||
$BackupCloud != true) do={
|
||||
:error ("Configured to send neither backup nor config export.");
|
||||
:log error ("Configured to send neither backup nor config export.");
|
||||
:error "Error: See log for details.";
|
||||
}
|
||||
|
||||
# filename based on identity
|
||||
|
|
|
@ -10,13 +10,15 @@
|
|||
:local LatestVersion [ / system package update get latest-version ];
|
||||
|
||||
:if ($InstalledVersion = $LatestVersion) do={
|
||||
:error ("Version " . $LatestVersion . " is already installed.");
|
||||
:log info ("Version " . $LatestVersion . " is already installed.");
|
||||
:error "No updates available.";
|
||||
}
|
||||
|
||||
:foreach Package in=[ / system package find where !bundle ] do={
|
||||
:local PkgName [ / system package get $Package name ];
|
||||
if ([ $DownloadPackage $PkgName $LatestVersion ] = false) do={
|
||||
:error ("Download for package " . $PkgName . " failed.");
|
||||
:log error ("Download for package " . $PkgName . " failed.");
|
||||
:error "Error: See log for details.";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
|
||||
# check mail server
|
||||
:if ([ / tool netwatch get [ find where comment=[ / tool e-mail get address ] ] status ] != "up") do={
|
||||
:error "Mail server is not up.";
|
||||
:log warning "Mail server is not up.";
|
||||
:error "Warning: See log for details.";
|
||||
}
|
||||
|
||||
:local Allowed [ / tool sms get allowed-number ];
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
:global CertificateAvailable;
|
||||
|
||||
:if ([ / ip cloud get ddns-enabled ] != true) do={
|
||||
:error "IP cloud DDNS is not enabled.";
|
||||
:log error "IP cloud DDNS is not enabled.";
|
||||
:error "Error: See log for details.";
|
||||
}
|
||||
|
||||
# Get the current ip address from cloud
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue