aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-03-08 17:32:12 +0100
committerGravatar Christian Hesse <mail@eworm.de>2024-03-12 20:37:57 +0100
commitba2df80f073caf6b426def177b217d1b37954d7f (patch)
tree5dadd74e56ded840e62e82127a9315c8769bfd83
parent19802c0b6977f9467fada4ace3cab017dd98964b (diff)
parent242ecef012f5208b6fa088a1222d0d5477e5b2ed (diff)
Merge branch 'LogPrint' into next
-rw-r--r--backup-cloud.rsc7
-rw-r--r--backup-email.rsc13
-rw-r--r--backup-partition.rsc12
-rw-r--r--backup-upload.rsc14
-rw-r--r--capsman-download-packages.capsman.rsc16
-rw-r--r--capsman-download-packages.template.rsc16
-rw-r--r--capsman-download-packages.wifi.rsc16
-rw-r--r--capsman-rolling-upgrade.capsman.rsc8
-rw-r--r--capsman-rolling-upgrade.template.rsc8
-rw-r--r--capsman-rolling-upgrade.wifi.rsc8
-rw-r--r--certificate-renew-issued.rsc10
-rw-r--r--check-certificates.rsc32
-rw-r--r--check-health.rsc6
-rw-r--r--check-lte-firmware-upgrade.rsc20
-rw-r--r--check-routeros-update.rsc35
-rw-r--r--collect-wireless-mac.capsman.rsc14
-rw-r--r--collect-wireless-mac.local.rsc14
-rw-r--r--collect-wireless-mac.template.rsc18
-rw-r--r--collect-wireless-mac.wifi.rsc14
-rw-r--r--daily-psk.capsman.rsc6
-rw-r--r--daily-psk.local.rsc6
-rw-r--r--daily-psk.template.rsc6
-rw-r--r--daily-psk.wifi.rsc6
-rw-r--r--dhcp-lease-comment.capsman.rsc4
-rw-r--r--dhcp-lease-comment.local.rsc4
-rw-r--r--dhcp-lease-comment.template.rsc4
-rw-r--r--dhcp-lease-comment.wifi.rsc4
-rw-r--r--dhcp-to-dns.rsc24
-rw-r--r--firmware-upgrade-reboot.rsc14
-rw-r--r--fw-addr-lists.rsc26
-rw-r--r--global-functions.rsc183
-rw-r--r--gps-track.rsc10
-rw-r--r--hotspot-to-wpa-cleanup.capsman.rsc14
-rw-r--r--hotspot-to-wpa-cleanup.template.rsc14
-rw-r--r--hotspot-to-wpa-cleanup.wifi.rsc14
-rw-r--r--hotspot-to-wpa.capsman.rsc15
-rw-r--r--hotspot-to-wpa.template.rsc15
-rw-r--r--hotspot-to-wpa.wifi.rsc15
-rw-r--r--ipsec-to-dns.rsc14
-rw-r--r--ipv6-update.rsc21
-rw-r--r--lease-script.rsc15
-rw-r--r--log-forward.rsc4
-rw-r--r--mod/bridge-port-to.rsc19
-rw-r--r--mod/bridge-port-vlan.rsc22
-rw-r--r--mod/notification-email.rsc12
-rw-r--r--mod/notification-matrix.rsc41
-rw-r--r--mod/notification-ntfy.rsc15
-rw-r--r--mod/notification-telegram.rsc15
-rw-r--r--mod/scriptrunonce.rsc13
-rw-r--r--mod/ssh-keys-import.rsc37
-rw-r--r--mode-button.rsc14
-rw-r--r--netwatch-dns.rsc25
-rw-r--r--netwatch-notify.rsc29
-rw-r--r--news-and-changes.rsc1
-rw-r--r--ospf-to-leds.rsc6
-rw-r--r--packages-update.rsc40
-rw-r--r--ppp-on-up.rsc11
-rw-r--r--sms-action.rsc7
-rw-r--r--sms-forward.rsc18
-rw-r--r--telegram-chat.rsc29
-rw-r--r--update-gre-address.rsc4
-rw-r--r--update-tunnelbroker.rsc14
62 files changed, 574 insertions, 517 deletions
diff --git a/backup-cloud.rsc b/backup-cloud.rsc
index 14af776..cccb41b 100644
--- a/backup-cloud.rsc
+++ b/backup-cloud.rsc
@@ -22,7 +22,7 @@
:global DeviceInfo;
:global FormatLine;
:global HumanReadableNum;
- :global LogPrintExit2;
+ :global LogPrint;
:global MkDir;
:global RandomDelay;
:global ScriptFromTerminal;
@@ -43,7 +43,8 @@
}
:if ([ $MkDir ("tmpfs/backup-cloud") ] = false) do={
- $LogPrintExit2 error $ScriptName ("Failed creating directory!") true;
+ $LogPrint error $ScriptName ("Failed creating directory!");
+ :error false;
}
:execute {
@@ -76,7 +77,7 @@
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "floppy-disk,warning-sign" ] . "Cloud backup failed"); \
message=("Failed uploading backup for " . $Identity . " to cloud!\n\n" . [ $DeviceInfo ]) });
- $LogPrintExit2 error $ScriptName ("Failed uploading backup for " . $Identity . " to cloud!") false;
+ $LogPrint error $ScriptName ("Failed uploading backup for " . $Identity . " to cloud!");
:set PackagesUpdateBackupFailure true;
:error false;
}
diff --git a/backup-email.rsc b/backup-email.rsc
index e4dec3b..64ca69c 100644
--- a/backup-email.rsc
+++ b/backup-email.rsc
@@ -27,7 +27,7 @@
:global CleanName;
:global DeviceInfo;
:global FormatLine;
- :global LogPrintExit2;
+ :global LogPrint;
:global MkDir;
:global RandomDelay;
:global ScriptFromTerminal;
@@ -38,12 +38,14 @@
:global WaitFullyConnected;
:if ([ :typeof $SendEMail2 ] = "nothing") do={
- $LogPrintExit2 error $ScriptName ("The module for sending notifications via e-mail is not installed.") true;
+ $LogPrint error $ScriptName ("The module for sending notifications via e-mail is not installed.");
+ :error false;
}
:if ($BackupSendBinary != true && \
$BackupSendExport != true) do={
- $LogPrintExit2 error $ScriptName ("Configured to send neither backup nor config export.") true;
+ $LogPrint error $ScriptName ("Configured to send neither backup nor config export.");
+ :error false;
}
:if ([ $ScriptLock $ScriptName ] = false) do={
@@ -66,7 +68,8 @@
:local Attach ({});
:if ([ $MkDir $DirName ] = false) do={
- $LogPrintExit2 error $ScriptName ("Failed creating directory!") true;
+ $LogPrint error $ScriptName ("Failed creating directory!");
+ :error false;
}
# binary backup
@@ -111,7 +114,7 @@
:local I 0;
:while ([ :len [ /file/find where name ~ ($FilePath . "\\.(backup|rsc)\$") ] ] > 0) do={
:if ($I >= 120) do={
- $LogPrintExit2 warning $ScriptName ("Files are still available, sending e-mail failed.") false;
+ $LogPrint warning $ScriptName ("Files are still available, sending e-mail failed.");
:set PackagesUpdateBackupFailure true;
:error false;
}
diff --git a/backup-partition.rsc b/backup-partition.rsc
index 13ed8b9..503d382 100644
--- a/backup-partition.rsc
+++ b/backup-partition.rsc
@@ -17,7 +17,7 @@
:global PackagesUpdateBackupFailure;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
@@ -26,7 +26,7 @@
}
:if ([ :len [ /partitions/find ] ] < 2) do={
- $LogPrintExit2 error $ScriptName ("Device does not have a fallback partition.") false;
+ $LogPrint error $ScriptName ("Device does not have a fallback partition.");
:set PackagesUpdateBackupFailure true;
:error false;
}
@@ -34,7 +34,7 @@
:local ActiveRunning [ /partitions/find where active running ];
:if ([ :len $ActiveRunning ] < 1) do={
- $LogPrintExit2 error $ScriptName ("Device is not running from active partition.") false;
+ $LogPrint error $ScriptName ("Device is not running from active partition.");
:set PackagesUpdateBackupFailure true;
:error false;
}
@@ -47,12 +47,10 @@
"[ /partitions/get [ find where running ] name ] . \"'!\")");
/partitions/save-config-to $FallbackTo;
/system/scheduler/remove "running-from-backup-partition";
- $LogPrintExit2 info $ScriptName ("Saved configuration to partition '" . \
- $FallbackTo . "'.") false;
+ $LogPrint info $ScriptName ("Saved configuration to partition '" . $FallbackTo . "'.");
} on-error={
/system/scheduler/remove [ find where name="running-from-backup-partition" ];
- $LogPrintExit2 error $ScriptName ("Failed saving configuration to partition '" . \
- $FallbackTo . "'!") false;
+ $LogPrint error $ScriptName ("Failed saving configuration to partition '" . $FallbackTo . "'!");
:set PackagesUpdateBackupFailure true;
:error false;
}
diff --git a/backup-upload.rsc b/backup-upload.rsc
index 769972b..ef5b7c7 100644
--- a/backup-upload.rsc
+++ b/backup-upload.rsc
@@ -30,7 +30,7 @@
:global CleanName;
:global DeviceInfo;
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global MkDir;
:global RandomDelay;
:global ScriptFromTerminal;
@@ -42,7 +42,8 @@
:if ($BackupSendBinary != true && \
$BackupSendExport != true) do={
- $LogPrintExit2 error $ScriptName ("Configured to send neither backup nor config export.") true;
+ $LogPrint error $ScriptName ("Configured to send neither backup nor config export.");
+ :error false;
}
:if ([ $ScriptLock $ScriptName ] = false) do={
@@ -65,7 +66,8 @@
:local Failed 0;
:if ([ $MkDir $DirName ] = false) do={
- $LogPrintExit2 error $ScriptName ("Failed creating directory!") true;
+ $LogPrint error $ScriptName ("Failed creating directory!");
+ :error false;
}
# binary backup
@@ -79,7 +81,7 @@
:set BackupFile [ /file/get ($FilePath . ".backup") ];
:set ($BackupFile->"name") ($FileName . ".backup");
} on-error={
- $LogPrintExit2 error $ScriptName ("Uploading backup file failed!") false;
+ $LogPrint error $ScriptName ("Uploading backup file failed!");
:set BackupFile "failed";
:set Failed 1;
}
@@ -98,7 +100,7 @@
:set ExportFile [ /file/get ($FilePath . ".rsc") ];
:set ($ExportFile->"name") ($FileName . ".rsc");
} on-error={
- $LogPrintExit2 error $ScriptName ("Uploading configuration export failed!") false;
+ $LogPrint error $ScriptName ("Uploading configuration export failed!");
:set ExportFile "failed";
:set Failed 1;
}
@@ -119,7 +121,7 @@
:set ConfigFile [ /file/get ($FilePath . ".conf") ];
:set ($ConfigFile->"name") ($FileName . ".conf");
} on-error={
- $LogPrintExit2 error $ScriptName ("Uploading global-config-overlay failed!") false;
+ $LogPrint error $ScriptName ("Uploading global-config-overlay failed!");
:set ConfigFile "failed";
:set Failed 1;
}
diff --git a/capsman-download-packages.capsman.rsc b/capsman-download-packages.capsman.rsc
index d4e900d..a3bd4a5 100644
--- a/capsman-download-packages.capsman.rsc
+++ b/capsman-download-packages.capsman.rsc
@@ -19,7 +19,7 @@
:global CleanFilePath;
:global DownloadPackage;
- :global LogPrintExit2;
+ :global LogPrint;
:global MkDir;
:global ScriptLock;
:global WaitFullyConnected;
@@ -34,16 +34,18 @@
:local Updated false;
:if ([ :len $PackagePath ] = 0) do={
- $LogPrintExit2 warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.") true;
+ $LogPrint warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.");
+ :error false;
}
:if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={
:if ([ $MkDir $PackagePath ] = false) do={
- $LogPrintExit2 warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
- $PackagePath . ") failed!") true;
+ $LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
+ $PackagePath . ") failed!");
+ :error false;
}
- $LogPrintExit2 info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \
- "). Please place your packages!") false;
+ $LogPrint info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \
+ "). Please place your packages!");
}
:foreach Package in=[ /file/find where type=package \
@@ -60,7 +62,7 @@
}
:if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={
- $LogPrintExit2 info $ScriptName ("No packages available, downloading default set.") false;
+ $LogPrint info $ScriptName ("No packages available, downloading default set.");
:foreach Arch in={ "arm"; "mipsbe" } do={
:foreach Package in={ "routeros"; "wireless" } do={
:if ([ $DownloadPackage $Package $InstalledVersion $Arch $PackagePath ] = true) do={
diff --git a/capsman-download-packages.template.rsc b/capsman-download-packages.template.rsc
index cd4a83b..cad3bcb 100644
--- a/capsman-download-packages.template.rsc
+++ b/capsman-download-packages.template.rsc
@@ -20,7 +20,7 @@
:global CleanFilePath;
:global DownloadPackage;
- :global LogPrintExit2;
+ :global LogPrint;
:global MkDir;
:global ScriptLock;
:global WaitFullyConnected;
@@ -36,16 +36,18 @@
:local Updated false;
:if ([ :len $PackagePath ] = 0) do={
- $LogPrintExit2 warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.") true;
+ $LogPrint warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.");
+ :error false;
}
:if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={
:if ([ $MkDir $PackagePath ] = false) do={
- $LogPrintExit2 warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
- $PackagePath . ") failed!") true;
+ $LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
+ $PackagePath . ") failed!");
+ :error false;
}
- $LogPrintExit2 info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \
- "). Please place your packages!") false;
+ $LogPrint info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \
+ "). Please place your packages!");
}
:foreach Package in=[ /file/find where type=package \
@@ -62,7 +64,7 @@
}
:if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={
- $LogPrintExit2 info $ScriptName ("No packages available, downloading default set.") false;
+ $LogPrint info $ScriptName ("No packages available, downloading default set.");
# NOT /interface/wifi/ #
:foreach Arch in={ "arm"; "mipsbe" } do={
:foreach Package in={ "routeros"; "wireless" } do={
diff --git a/capsman-download-packages.wifi.rsc b/capsman-download-packages.wifi.rsc
index 633830a..909688f 100644
--- a/capsman-download-packages.wifi.rsc
+++ b/capsman-download-packages.wifi.rsc
@@ -19,7 +19,7 @@
:global CleanFilePath;
:global DownloadPackage;
- :global LogPrintExit2;
+ :global LogPrint;
:global MkDir;
:global ScriptLock;
:global WaitFullyConnected;
@@ -34,16 +34,18 @@
:local Updated false;
:if ([ :len $PackagePath ] = 0) do={
- $LogPrintExit2 warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.") true;
+ $LogPrint warning $ScriptName ("The CAPsMAN package path is not defined, can not download packages.");
+ :error false;
}
:if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={
:if ([ $MkDir $PackagePath ] = false) do={
- $LogPrintExit2 warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
- $PackagePath . ") failed!") true;
+ $LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
+ $PackagePath . ") failed!");
+ :error false;
}
- $LogPrintExit2 info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \
- "). Please place your packages!") false;
+ $LogPrint info $ScriptName ("Created directory at CAPsMAN package path (" . $PackagePath . \
+ "). Please place your packages!");
}
:foreach Package in=[ /file/find where type=package \
@@ -60,7 +62,7 @@
}
:if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={
- $LogPrintExit2 info $ScriptName ("No packages available, downloading default set.") false;
+ $LogPrint info $ScriptName ("No packages available, downloading default set.");
:foreach Arch in={ "arm"; "arm64" } do={
:local Packages { "arm"={ "routeros"; "wifi-qcom"; "wifi-qcom-ac" };
"arm64"={ "routeros"; "wifi-qcom" } };
diff --git a/capsman-rolling-upgrade.capsman.rsc b/capsman-rolling-upgrade.capsman.rsc
index 16a3498..11bfd69 100644
--- a/capsman-rolling-upgrade.capsman.rsc
+++ b/capsman-rolling-upgrade.capsman.rsc
@@ -18,7 +18,7 @@
:do {
:local ScriptName [ :jobname ];
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
@@ -34,11 +34,11 @@
:foreach RemoteCap in=[ /caps-man/remote-cap/find where version!=$InstalledVersion ] do={
:local RemoteCapVal [ /caps-man/remote-cap/get $RemoteCap ];
:if ([ :len $RemoteCapVal ] > 1) do={
- $LogPrintExit2 info $ScriptName ("Starting upgrade for " . $RemoteCapVal->"name" . \
- " (" . $RemoteCapVal->"identity" . ")...") false;
+ $LogPrint info $ScriptName ("Starting upgrade for " . $RemoteCapVal->"name" . \
+ " (" . $RemoteCapVal->"identity" . ")...");
/caps-man/remote-cap/upgrade $RemoteCap;
} else={
- $LogPrintExit2 warning $ScriptName ("Remote CAP vanished, skipping upgrade.") false;
+ $LogPrint warning $ScriptName ("Remote CAP vanished, skipping upgrade.");
}
:delay ($Delay . "s");
}
diff --git a/capsman-rolling-upgrade.template.rsc b/capsman-rolling-upgrade.template.rsc
index 45a5f8e..e0effd4 100644
--- a/capsman-rolling-upgrade.template.rsc
+++ b/capsman-rolling-upgrade.template.rsc
@@ -19,7 +19,7 @@
:do {
:local ScriptName [ :jobname ];
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
@@ -41,12 +41,12 @@
# NOT /caps-man/ #
:set ($RemoteCapVal->"name") ($RemoteCapVal->"common-name");
# NOT /caps-man/ #
- $LogPrintExit2 info $ScriptName ("Starting upgrade for " . $RemoteCapVal->"name" . \
- " (" . $RemoteCapVal->"identity" . ")...") false;
+ $LogPrint info $ScriptName ("Starting upgrade for " . $RemoteCapVal->"name" . \
+ " (" . $RemoteCapVal->"identity" . ")...");
/caps-man/remote-cap/upgrade $RemoteCap;
/interface/wifi/capsman/remote-cap/upgrade $RemoteCap;
} else={
- $LogPrintExit2 warning $ScriptName ("Remote CAP vanished, skipping upgrade.") false;
+ $LogPrint warning $ScriptName ("Remote CAP vanished, skipping upgrade.");
}
:delay ($Delay . "s");
}
diff --git a/capsman-rolling-upgrade.wifi.rsc b/capsman-rolling-upgrade.wifi.rsc
index 63245dc..8ec6f26 100644
--- a/capsman-rolling-upgrade.wifi.rsc
+++ b/capsman-rolling-upgrade.wifi.rsc
@@ -18,7 +18,7 @@
:do {
:local ScriptName [ :jobname ];
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
@@ -35,11 +35,11 @@
:local RemoteCapVal [ /interface/wifi/capsman/remote-cap/get $RemoteCap ];
:if ([ :len $RemoteCapVal ] > 1) do={
:set ($RemoteCapVal->"name") ($RemoteCapVal->"common-name");
- $LogPrintExit2 info $ScriptName ("Starting upgrade for " . $RemoteCapVal->"name" . \
- " (" . $RemoteCapVal->"identity" . ")...") false;
+ $LogPrint info $ScriptName ("Starting upgrade for " . $RemoteCapVal->"name" . \
+ " (" . $RemoteCapVal->"identity" . ")...");
/interface/wifi/capsman/remote-cap/upgrade $RemoteCap;
} else={
- $LogPrintExit2 warning $ScriptName ("Remote CAP vanished, skipping upgrade.") false;
+ $LogPrint warning $ScriptName ("Remote CAP vanished, skipping upgrade.");
}
:delay ($Delay . "s");
}
diff --git a/certificate-renew-issued.rsc b/certificate-renew-issued.rsc
index a360a3f..45805c5 100644
--- a/certificate-renew-issued.rsc
+++ b/certificate-renew-issued.rsc
@@ -16,7 +16,7 @@
:global CertIssuedExportPass;
- :global LogPrintExit2;
+ :global LogPrint;
:global MkDir;
:global ScriptLock;
@@ -36,13 +36,13 @@
/certificate/export-certificate ($CertVal->"name") type=pkcs12 \
file-name=("cert-issued/" . $CertVal->"common-name") \
export-passphrase=($CertIssuedExportPass->($CertVal->"common-name"));
- $LogPrintExit2 info $ScriptName ("Issued a new certificate for \"" . $CertVal->"common-name" . \
- "\", exported to \"cert-issued/" . $CertVal->"common-name" . ".p12\".") false;
+ $LogPrint info $ScriptName ("Issued a new certificate for \"" . $CertVal->"common-name" . \
+ "\", exported to \"cert-issued/" . $CertVal->"common-name" . ".p12\".");
} else={
- $LogPrintExit2 warning $ScriptName ("Failed creating directory, not exporting certificate.") false;
+ $LogPrint warning $ScriptName ("Failed creating directory, not exporting certificate.");
}
} else={
- $LogPrintExit2 info $ScriptName ("Issued a new certificate for \"" . $CertVal->"common-name" . "\".") false;
+ $LogPrint info $ScriptName ("Issued a new certificate for \"" . $CertVal->"common-name" . "\".");
}
}
} on-error={ }
diff --git a/check-certificates.rsc b/check-certificates.rsc
index edde7f3..7504955 100644
--- a/check-certificates.rsc
+++ b/check-certificates.rsc
@@ -22,7 +22,7 @@
:global CertificateAvailable
:global EscapeForRegEx;
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
:global SendNotification2;
@@ -39,7 +39,7 @@
:global CertificateNameByCN;
:global EscapeForRegEx;
:global FetchUserAgent;
- :global LogPrintExit2;
+ :global LogPrint;
:global UrlEncode;
:global WaitForFile;
@@ -62,7 +62,7 @@
/file/remove [ find where name=$CertFileName ];
:if ($DecryptionFailed = true) do={
- $LogPrintExit2 warning $0 ("Decryption failed for certificate file '" . $CertFileName . "'.") false;
+ $LogPrint warning $0 ("Decryption failed for certificate file '" . $CertFileName . "'.");
}
:foreach CertInChain in=[ /certificate/find where name~("^" . [ $EscapeForRegEx $CertFileName ] . "_[0-9]+\$") \
@@ -72,7 +72,7 @@
:set Return true;
} on-error={
- $LogPrintExit2 debug $0 ("Could not download certificate file '" . $CertFileName . "'.") false;
+ $LogPrint debug $0 ("Could not download certificate file '" . $CertFileName . "'.");
}
}
@@ -143,9 +143,10 @@
:do {
:if ([ :len $CertRenewUrl ] = 0) do={
- $LogPrintExit2 info $ScriptName ("No CertRenewUrl given.") true;
+ $LogPrint info $ScriptName ("No CertRenewUrl given.");
+ :error false;
}
- $LogPrintExit2 info $ScriptName ("Attempting to renew certificate '" . ($CertVal->"name") . "'.") false;
+ $LogPrint info $ScriptName ("Attempting to renew certificate '" . ($CertVal->"name") . "'.");
:local ImportSuccess false;
:set LastName ($CertVal->"common-name");
@@ -159,10 +160,10 @@
:if ($ImportSuccess = false) do={ :error false; }
:if ([ :len ($CertVal->"fingerprint") ] > 0 && $CertVal->"fingerprint" != [ /certificate/get $Cert fingerprint ]) do={
- $LogPrintExit2 debug $ScriptName ("Certificate '" . $CertVal->"name" . "' was updated in place.") false;
+ $LogPrint debug $ScriptName ("Certificate '" . $CertVal->"name" . "' was updated in place.");
:set CertVal [ /certificate/get $Cert ];
} else={
- $LogPrintExit2 debug $ScriptName ("Certificate '" . $CertVal->"name" . "' was not updated, but replaced.") false;
+ $LogPrint debug $ScriptName ("Certificate '" . $CertVal->"name" . "' was not updated, but replaced.");
:set CertNew [ /certificate/find where name~("^" . [ $EscapeForRegEx [ $UrlEncode $LastName ] ] . "\\.(p12|pem)_[0-9]+\$") \
(common-name=($CertVal->"common-name") or subject-alt-name~("(^|\\W)(DNS|IP):" . [ $EscapeForRegEx $LastName ] . "(\\W|\$)")) \
@@ -170,12 +171,13 @@
:local CertNewVal [ /certificate/get $CertNew ];
:if ([ $CertificateAvailable ([ $ParseKeyValueStore ($CertNewVal->"issuer") ]->"CN") ] = false) do={
- $LogPrintExit2 warning $ScriptName ("The certificate chain is not available!") false;
+ $LogPrint warning $ScriptName ("The certificate chain is not available!");
}
:if (($CertVal->"private-key") = true && ($CertVal->"private-key") != ($CertNewVal->"private-key")) do={
/certificate/remove $CertNew;
- $LogPrintExit2 warning $ScriptName ("Old certificate '" . ($CertVal->"name") . "' has a private key, new certificate does not. Aborting renew.") true;
+ $LogPrint warning $ScriptName ("Old certificate '" . ($CertVal->"name") . "' has a private key, new certificate does not. Aborting renew.");
+ :error false;
}
/ip/service/set certificate=($CertNewVal->"name") [ find where certificate=($CertVal->"name") ];
@@ -194,9 +196,9 @@
$SendNotification2 ({ origin=$ScriptName; silent=true; \
subject=([ $SymbolForNotification "lock-with-ink-pen" ] . "Certificate renewed: " . ($CertVal->"name")); \
message=("A certificate on " . $Identity . " has been renewed.\n\n" . [ $FormatInfo $CertNew ]) });
- $LogPrintExit2 info $ScriptName ("The certificate '" . ($CertVal->"name") . "' has been renewed.") false;
+ $LogPrint info $ScriptName ("The certificate '" . ($CertVal->"name") . "' has been renewed.");
} on-error={
- $LogPrintExit2 debug $ScriptName ("Could not renew certificate '" . ($CertVal->"name") . "'.") false;
+ $LogPrint debug $ScriptName ("Could not renew certificate '" . ($CertVal->"name") . "'.");
}
}
@@ -205,15 +207,15 @@
:local CertVal [ /certificate/get $Cert ];
:if ([ :len [ /certificate/scep-server/find where ca-cert=($CertVal->"ca") ] ] > 0) do={
- $LogPrintExit2 debug $ScriptName ("Certificate '" . ($CertVal->"name") . "' is handled by SCEP, skipping.") false;
+ $LogPrint debug $ScriptName ("Certificate '" . ($CertVal->"name") . "' is handled by SCEP, skipping.");
} else={
:local State [ $IfThenElse (($CertVal->"expired") = true) "expired" "is about to expire" ];
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "warning-sign" ] . "Certificate warning: " . ($CertVal->"name")); \
message=("A certificate on " . $Identity . " " . $State . ".\n\n" . [ $FormatInfo $Cert ]) });
- $LogPrintExit2 info $ScriptName ("The certificate '" . ($CertVal->"name") . "' " . $State . \
- ", it is invalid after " . ($CertVal->"invalid-after") . ".") false;
+ $LogPrint info $ScriptName ("The certificate '" . ($CertVal->"name") . "' " . $State . \
+ ", it is invalid after " . ($CertVal->"invalid-after") . ".");
}
}
} on-error={ }
diff --git a/check-health.rsc b/check-health.rsc
index 91330fc..2a97ad6 100644
--- a/check-health.rsc
+++ b/check-health.rsc
@@ -28,7 +28,7 @@
:global FormatLine;
:global HumanReadableNum;
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
@@ -77,7 +77,7 @@
}
:if ([ :len [ /system/health/find ] ] = 0) do={
- $LogPrintExit2 debug $ScriptName ("Your device does not provide any health values.") false;
+ $LogPrint debug $ScriptName ("Your device does not provide any health values.");
:error true;
}
@@ -148,7 +148,7 @@
:if ([ :typeof ($CheckHealthLast->$Name) ] != "nothing") do={
:if ([ :typeof ($CheckHealthTemperature->$Name) ] != "num" ) do={
- $LogPrintExit2 info $ScriptName ("No threshold given for " . $Name . ", assuming 50C.") false;
+ $LogPrint info $ScriptName ("No threshold given for " . $Name . ", assuming 50C.");
:set ($CheckHealthTemperature->$Name) 50;
}
:local Validate [ /system/health/get [ find where name=$Name ] value ];
diff --git a/check-lte-firmware-upgrade.rsc b/check-lte-firmware-upgrade.rsc
index f2a6e37..e7f06f3 100644
--- a/check-lte-firmware-upgrade.rsc
+++ b/check-lte-firmware-upgrade.rsc
@@ -35,7 +35,7 @@
:global FormatLine;
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptFromTerminal;
:global SendNotification2;
:global SymbolForNotification;
@@ -47,19 +47,19 @@
:set Firmware [ /interface/lte/firmware-upgrade $Interface once as-value ];
:set Info [ /interface/lte/monitor $Interface once as-value ];
} on-error={
- $LogPrintExit2 debug $ScriptName ("Could not get latest LTE firmware version for interface " . \
- $IntName . ".") false;
+ $LogPrint debug $ScriptName ("Could not get latest LTE firmware version for interface " . \
+ $IntName . ".");
:return false;
}
:if ([ :len ($Firmware->"latest") ] = 0) do={
- $LogPrintExit2 info $ScriptName ("An empty string is not a valid version.") false;
+ $LogPrint info $ScriptName ("An empty string is not a valid version.");
:return false;
}
:if (($Firmware->"installed") = ($Firmware->"latest")) do={
:if ([ $ScriptFromTerminal $ScriptName ] = true) do={
- $LogPrintExit2 info $ScriptName ("No firmware upgrade available for LTE interface " . $IntName . ".") false;
+ $LogPrint info $ScriptName ("No firmware upgrade available for LTE interface " . $IntName . ".");
}
:return true;
}
@@ -69,7 +69,7 @@
:put ("Do you want to start unattended lte firmware upgrade for interface " . $IntName . "? [y/N]");
:if (([ /terminal/inkey timeout=60 ] % 32) = 25) do={
/system/script/run unattended-lte-firmware-upgrade;
- $LogPrintExit2 info $ScriptName ("Scheduled lte firmware upgrade for interface " . $IntName . "...") false;
+ $LogPrint info $ScriptName ("Scheduled lte firmware upgrade for interface " . $IntName . "...");
:return true;
} else={
:put "Canceled...";
@@ -77,13 +77,13 @@
}
:if (($SentLteFirmwareUpgradeNotification->$IntName) = ($Firmware->"latest")) do={
- $LogPrintExit2 debug $ScriptName ("Already sent the LTE firmware upgrade notification for version " . \
- ($Firmware->"latest") . ".") false;
+ $LogPrint debug $ScriptName ("Already sent the LTE firmware upgrade notification for version " . \
+ ($Firmware->"latest") . ".");
:return false;
}
- $LogPrintExit2 info $ScriptName ("A new firmware version " . ($Firmware->"latest") . " is available for " . \
- "LTE interface " . $IntName . ".") false;
+ $LogPrint info $ScriptName ("A new firmware version " . ($Firmware->"latest") . " is available for " . \
+ "LTE interface " . $IntName . ".");
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "sparkles" ] . "LTE firmware upgrade"); \
message=("A new firmware version " . ($Firmware->"latest") . " is available for " . \
diff --git a/check-routeros-update.rsc b/check-routeros-update.rsc
index a68762b..e209610 100644
--- a/check-routeros-update.rsc
+++ b/check-routeros-update.rsc
@@ -24,7 +24,7 @@
:global DeviceInfo;
:global EscapeForRegEx;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptFromTerminal;
:global ScriptLock;
:global SendNotification2;
@@ -50,12 +50,12 @@
:error "A reboot for update is already scheduled.";
}
- $LogPrintExit2 debug $ScriptName ("Checking for updates...") false;
+ $LogPrint debug $ScriptName ("Checking for updates...");
/system/package/update/check-for-updates without-paging as-value;
:local Update [ /system/package/update/get ];
:if ([ $ScriptFromTerminal $ScriptName ] = true && ($Update->"installed-version") = ($Update->"latest-version")) do={
- $LogPrintExit2 info $ScriptName ("System is already up to date.") false;
+ $LogPrint info $ScriptName ("System is already up to date.");
:error true;
}
@@ -64,13 +64,14 @@
:local Link ("https://mikrotik.com/download/changelogs/" . $Update->"channel" . "-release-tree");
:if ($NumLatest < 117505792) do={
- $LogPrintExit2 info $ScriptName ("The version '" . ($Update->"latest-version") . "' is not a valid version.") true;
+ $LogPrint info $ScriptName ("The version '" . ($Update->"latest-version") . "' is not a valid version.");
+ :error false;
}
:if ($NumInstalled < $NumLatest) do={
:if ($SafeUpdateAll ~ "^YES,? ?PLEASE!?\$") do={
- $LogPrintExit2 info $ScriptName ("Installing ALL versions automatically, including " . \
- $Update->"latest-version" . "...") false;
+ $LogPrint info $ScriptName ("Installing ALL versions automatically, including " . \
+ $Update->"latest-version" . "...");
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "sparkles" ] . "RouterOS update: " . $Update->"latest-version"); \
message=("Installing ALL versions automatically, including " . $Update->"latest-version" . \
@@ -79,7 +80,7 @@
}
:if ($SafeUpdatePatch = true && ($NumInstalled & 0xffff0000) = ($NumLatest & 0xffff0000)) do={
- $LogPrintExit2 info $ScriptName ("Version " . $Update->"latest-version" . " is a patch release, updating...") false;
+ $LogPrint info $ScriptName ("Version " . $Update->"latest-version" . " is a patch release, updating...");
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "sparkles" ] . "RouterOS update: " . $Update->"latest-version"); \
message=("Version " . $Update->"latest-version" . " is a patch update for " . $Update->"channel" . \
@@ -92,8 +93,8 @@
version~("^" . [ $EscapeForRegEx ($Update->"latest-version") ] . "\\b") ];
:if ([ :len $Neighbors ] > 0) do={
:local Neighbor [ /ip/neighbor/get ($Neighbors->0) identity ];
- $LogPrintExit2 info $ScriptName ("Seen a neighbor (" . $Neighbor . ") running version " . \
- $Update->"latest-version" . " from " . $Update->"channel" . ", updating...") false;
+ $LogPrint info $ScriptName ("Seen a neighbor (" . $Neighbor . ") running version " . \
+ $Update->"latest-version" . " from " . $Update->"channel" . ", updating...");
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "sparkles" ] . "RouterOS update: " . $Update->"latest-version"); \
message=("Seen a neighbor (" . $Neighbor . ") running version " . $Update->"latest-version" . \
@@ -109,10 +110,10 @@
($SafeUpdateUrl . $Update->"channel" . "?installed=" . $Update->"installed-version" . \
"&latest=" . $Update->"latest-version") output=user as-value ];
} on-error={
- $LogPrintExit2 warning $ScriptName ("Failed receiving safe version for " . $Update->"channel" . ".") false;
+ $LogPrint warning $ScriptName ("Failed receiving safe version for " . $Update->"channel" . ".");
}
:if ($Result->"status" = "finished" && $Result->"data" = $Update->"latest-version") do={
- $LogPrintExit2 info $ScriptName ("Version " . $Update->"latest-version" . " is considered safe, updating...") false;
+ $LogPrint info $ScriptName ("Version " . $Update->"latest-version" . " is considered safe, updating...");
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "sparkles" ] . "RouterOS update: " . $Update->"latest-version"); \
message=("Version " . $Update->"latest-version" . " is considered safe for " . $Update->"channel" . \
@@ -131,8 +132,8 @@
}
:if ($SentRouterosUpdateNotification = $Update->"latest-version") do={
- $LogPrintExit2 info $ScriptName ("Already sent the RouterOS update notification for version " . \
- $Update->"latest-version" . ".") false;
+ $LogPrint info $ScriptName ("Already sent the RouterOS update notification for version " . \
+ $Update->"latest-version" . ".");
:error true;
}
@@ -146,8 +147,8 @@
:if ($NumInstalled > $NumLatest) do={
:if ($SentRouterosUpdateNotification = $Update->"latest-version") do={
- $LogPrintExit2 info $ScriptName ("Already sent the RouterOS downgrade notification for version " . \
- $Update->"latest-version" . ".") false;
+ $LogPrint info $ScriptName ("Already sent the RouterOS downgrade notification for version " . \
+ $Update->"latest-version" . ".");
:error true;
}
@@ -156,8 +157,8 @@
message=("A different RouterOS version " . ($Update->"latest-version") . \
" is available for " . $Identity . ", but it is a downgrade.\n\n" . \
[ $DeviceInfo ]); link=$Link; silent=true });
- $LogPrintExit2 info $ScriptName ("A different RouterOS version " . ($Update->"latest-version") . \
- " is available for downgrade.") false;
+ $LogPrint info $ScriptName ("A different RouterOS version " . ($Update->"latest-version") . \
+ " is available for downgrade.");
:set SentRouterosUpdateNotification ($Update->"latest-version");
}
} on-error={ }
diff --git a/collect-wireless-mac.capsman.rsc b/collect-wireless-mac.capsman.rsc
index 5423624..dcb303c 100644
--- a/collect-wireless-mac.capsman.rsc
+++ b/collect-wireless-mac.capsman.rsc
@@ -23,7 +23,7 @@
:global FormatLine;
:global FormatMultiLines;
:global GetMacVendor;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
@@ -34,7 +34,7 @@
:if ([ :len [ /caps-man/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
/caps-man/access-list/add comment="--- collected above ---" disabled=yes;
- $LogPrintExit2 warning $ScriptName ("Added disabled access-list entry with comment '--- collected above ---'.") false;
+ $LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- collected above ---'.");
}
:local PlaceBefore ([ /caps-man/access-list/find where comment="--- collected above ---" disabled ]->0);
@@ -43,14 +43,14 @@
:do {
:set RegVal [ /caps-man/registration-table/get $Reg ];
} on-error={
- $LogPrintExit2 debug $ScriptName ("Device already gone... Ignoring.") false;
+ $LogPrint debug $ScriptName ("Device already gone... Ignoring.");
}
:if ([ :len ($RegVal->"mac-address") ] > 0) do={
:local AccessList ([ /caps-man/access-list/find where mac-address=($RegVal->"mac-address") ]->0);
:if ([ :len $AccessList ] > 0) do={
- $LogPrintExit2 debug $ScriptName ("MAC address " . $RegVal->"mac-address" . " already known: " . \
- [ /caps-man/access-list/get $AccessList comment ]) false;
+ $LogPrint debug $ScriptName ("MAC address " . $RegVal->"mac-address" . " already known: " . \
+ [ /caps-man/access-list/get $AccessList comment ]);
}
:if ([ :len $AccessList ] = 0) do={
@@ -74,7 +74,7 @@
:local Vendor [ $GetMacVendor ($RegVal->"mac-address") ];
:local Message ("MAC address " . $RegVal->"mac-address" . " (" . $Vendor . ", " . $HostName . ") " . \
"first seen on " . $DateTime . " connected to SSID " . $RegVal->"ssid" . ", interface " . $RegVal->"interface");
- $LogPrintExit2 info $ScriptName $Message false;
+ $LogPrint info $ScriptName $Message;
/caps-man/access-list/add place-before=$PlaceBefore comment=$Message mac-address=($RegVal->"mac-address") disabled=yes;
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "mobile-phone" ] . $RegVal->"mac-address" . " connected to " . $RegVal->"ssid"); \
@@ -90,7 +90,7 @@
[ $FormatLine "Date" $DateTime ]) });
}
} else={
- $LogPrintExit2 debug $ScriptName ("No mac address available... Ignoring.") false;
+ $LogPrint debug $ScriptName ("No mac address available... Ignoring.");
}
}
} on-error={ }
diff --git a/collect-wireless-mac.local.rsc b/collect-wireless-mac.local.rsc
index a4e81a3..7c1122c 100644
--- a/collect-wireless-mac.local.rsc
+++ b/collect-wireless-mac.local.rsc
@@ -23,7 +23,7 @@
:global FormatLine;
:global FormatMultiLines;
:global GetMacVendor;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
@@ -34,7 +34,7 @@
:if ([ :len [ /interface/wireless/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
/interface/wireless/access-list/add comment="--- collected above ---" disabled=yes;
- $LogPrintExit2 warning $ScriptName ("Added disabled access-list entry with comment '--- collected above ---'.") false;
+ $LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- collected above ---'.");
}
:local PlaceBefore ([ /interface/wireless/access-list/find where comment="--- collected above ---" disabled ]->0);
@@ -43,14 +43,14 @@
:do {
:set RegVal [ /interface/wireless/registration-table/get $Reg ];
} on-error={
- $LogPrintExit2 debug $ScriptName ("Device already gone... Ignoring.") false;
+ $LogPrint debug $ScriptName ("Device already gone... Ignoring.");
}
:if ([ :len ($RegVal->"mac-address") ] > 0) do={
:local AccessList ([ /interface/wireless/access-list/find where mac-address=($RegVal->"mac-address") ]->0);
:if ([ :len $AccessList ] > 0) do={
- $LogPrintExit2 debug $ScriptName ("MAC address " . $RegVal->"mac-address" . " already known: " . \
- [ /interface/wireless/access-list/get $AccessList comment ]) false;
+ $LogPrint debug $ScriptName ("MAC address " . $RegVal->"mac-address" . " already known: " . \
+ [ /interface/wireless/access-list/get $AccessList comment ]);
}
:if ([ :len $AccessList ] = 0) do={
@@ -75,7 +75,7 @@
:local Vendor [ $GetMacVendor ($RegVal->"mac-address") ];
:local Message ("MAC address " . $RegVal->"mac-address" . " (" . $Vendor . ", " . $HostName . ") " . \
"first seen on " . $DateTime . " connected to SSID " . $RegVal->"ssid" . ", interface " . $RegVal->"interface");
- $LogPrintExit2 info $ScriptName $Message false;
+ $LogPrint info $ScriptName $Message;
/interface/wireless/access-list/add place-before=$PlaceBefore comment=$Message mac-address=($RegVal->"mac-address") disabled=yes;
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "mobile-phone" ] . $RegVal->"mac-address" . " connected to " . $RegVal->"ssid"); \
@@ -91,7 +91,7 @@
[ $FormatLine "Date" $DateTime ]) });
}
} else={
- $LogPrintExit2 debug $ScriptName ("No mac address available... Ignoring.") false;
+ $LogPrint debug $ScriptName ("No mac address available... Ignoring.");
}
}
} on-error={ }
diff --git a/collect-wireless-mac.template.rsc b/collect-wireless-mac.template.rsc
index f647eb3..b8c5ff8 100644
--- a/collect-wireless-mac.template.rsc
+++ b/collect-wireless-mac.template.rsc
@@ -24,7 +24,7 @@
:global FormatLine;
:global FormatMultiLines;
:global GetMacVendor;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
@@ -39,7 +39,7 @@
/caps-man/access-list/add comment="--- collected above ---" disabled=yes;
/interface/wifi/access-list/add comment="--- collected above ---" disabled=yes;
/interface/wireless/access-list/add comment="--- collected above ---" disabled=yes;
- $LogPrintExit2 warning $ScriptName ("Added disabled access-list entry with comment '--- collected above ---'.") false;
+ $LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- collected above ---'.");
}
:local PlaceBefore ([ /caps-man/access-list/find where comment="--- collected above ---" disabled ]->0);
:local PlaceBefore ([ /interface/wifi/access-list/find where comment="--- collected above ---" disabled ]->0);
@@ -54,7 +54,7 @@
:set RegVal [ /interface/wifi/registration-table/get $Reg ];
:set RegVal [ /interface/wireless/registration-table/get $Reg ];
} on-error={
- $LogPrintExit2 debug $ScriptName ("Device already gone... Ignoring.") false;
+ $LogPrint debug $ScriptName ("Device already gone... Ignoring.");
}
:if ([ :len ($RegVal->"mac-address") ] > 0) do={
@@ -62,10 +62,10 @@
:local AccessList ([ /interface/wifi/access-list/find where mac-address=($RegVal->"mac-address") ]->0);
:local AccessList ([ /interface/wireless/access-list/find where mac-address=($RegVal->"mac-address") ]->0);
:if ([ :len $AccessList ] > 0) do={
- $LogPrintExit2 debug $ScriptName ("MAC address " . $RegVal->"mac-address" . " already known: " . \
- [ /caps-man/access-list/get $AccessList comment ]) false;
- [ /interface/wifi/access-list/get $AccessList comment ]) false;
- [ /interface/wireless/access-list/get $AccessList comment ]) false;
+ $LogPrint debug $ScriptName ("MAC address " . $RegVal->"mac-address" . " already known: " . \
+ [ /caps-man/access-list/get $AccessList comment ]);
+ [ /interface/wifi/access-list/get $AccessList comment ]);
+ [ /interface/wireless/access-list/get $AccessList comment ]);
}
:if ([ :len $AccessList ] = 0) do={
@@ -90,7 +90,7 @@
:local Vendor [ $GetMacVendor ($RegVal->"mac-address") ];
:local Message ("MAC address " . $RegVal->"mac-address" . " (" . $Vendor . ", " . $HostName . ") " . \
"first seen on " . $DateTime . " connected to SSID " . $RegVal->"ssid" . ", interface " . $RegVal->"interface");
- $LogPrintExit2 info $ScriptName $Message false;
+ $LogPrint info $ScriptName $Message;
/caps-man/access-list/add place-before=$PlaceBefore comment=$Message mac-address=($RegVal->"mac-address") disabled=yes;
/interface/wifi/access-list/add place-before=$PlaceBefore comment=$Message mac-address=($RegVal->"mac-address") disabled=yes;
/interface/wireless/access-list/add place-before=$PlaceBefore comment=$Message mac-address=($RegVal->"mac-address") disabled=yes;
@@ -108,7 +108,7 @@
[ $FormatLine "Date" $DateTime ]) });
}
} else={
- $LogPrintExit2 debug $ScriptName ("No mac address available... Ignoring.") false;
+ $LogPrint debug $ScriptName ("No mac address available... Ignoring.");
}
}
} on-error={ }
diff --git a/collect-wireless-mac.wifi.rsc b/collect-wireless-mac.wifi.rsc
index 063d6dc..b8ad939 100644
--- a/collect-wireless-mac.wifi.rsc
+++ b/collect-wireless-mac.wifi.rsc
@@ -23,7 +23,7 @@
:global FormatLine;
:global FormatMultiLines;
:global GetMacVendor;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
@@ -34,7 +34,7 @@
:if ([ :len [ /interface/wifi/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
/interface/wifi/access-list/add comment="--- collected above ---" disabled=yes;
- $LogPrintExit2 warning $ScriptName ("Added disabled access-list entry with comment '--- collected above ---'.") false;
+ $LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- collected above ---'.");
}
:local PlaceBefore ([ /interface/wifi/access-list/find where comment="--- collected above ---" disabled ]->0);
@@ -43,14 +43,14 @@
:do {
:set RegVal [ /interface/wifi/registration-table/get $Reg ];
} on-error={
- $LogPrintExit2 debug $ScriptName ("Device already gone... Ignoring.") false;
+ $LogPrint debug $ScriptName ("Device already gone... Ignoring.");
}
:if ([ :len ($RegVal->"mac-address") ] > 0) do={
:local AccessList ([ /interface/wifi/access-list/find where mac-address=($RegVal->"mac-address") ]->0);
:if ([ :len $AccessList ] > 0) do={
- $LogPrintExit2 debug $ScriptName ("MAC address " . $RegVal->"mac-address" . " already known: " . \
- [ /interface/wifi/access-list/get $AccessList comment ]) false;
+ $LogPrint debug $ScriptName ("MAC address " . $RegVal->"mac-address" . " already known: " . \
+ [ /interface/wifi/access-list/get $AccessList comment ]);
}
:if ([ :len $AccessList ] = 0) do={
@@ -74,7 +74,7 @@
:local Vendor [ $GetMacVendor ($RegVal->"mac-address") ];
:local Message ("MAC address " . $RegVal->"mac-address" . " (" . $Vendor . ", " . $HostName . ") " . \
"first seen on " . $DateTime . " connected to SSID " . $RegVal->"ssid" . ", interface " . $RegVal->"interface");
- $LogPrintExit2 info $ScriptName $Message false;
+ $LogPrint info $ScriptName $Message;
/interface/wifi/access-list/add place-before=$PlaceBefore comment=$Message mac-address=($RegVal->"mac-address") disabled=yes;
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "mobile-phone" ] . $RegVal->"mac-address" . " connected to " . $RegVal->"ssid"); \
@@ -90,7 +90,7 @@
[ $FormatLine "Date" $DateTime ]) });
}
} else={
- $LogPrintExit2 debug $ScriptName ("No mac address available... Ignoring.") false;
+ $LogPrint debug $ScriptName ("No mac address available... Ignoring.");
}
}
} on-error={ }
diff --git a/daily-psk.capsman.rsc b/daily-psk.capsman.rsc
index c9c0186..43651d0 100644
--- a/daily-psk.capsman.rsc
+++ b/daily-psk.capsman.rsc
@@ -22,7 +22,7 @@
:global Identity;
:global FormatLine;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
@@ -68,12 +68,12 @@
:local Skip 0;
:if ($NewPsk != $OldPsk) do={
- $LogPrintExit2 info $ScriptName ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")") false;
+ $LogPrint info $ScriptName ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")");
/caps-man/access-list/set $AccList private-passphrase=$NewPsk;
:if ([ :len [ /caps-man/actual-interface-configuration/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={
:if ($Seen->$Ssid = 1) do={
- $LogPrintExit2 debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;
+ $LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
} else={
:local Link ($DailyPskQrCodeUrl . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
diff --git a/daily-psk.local.rsc b/daily-psk.local.rsc
index 228efc8..2dbc61b 100644
--- a/daily-psk.local.rsc
+++ b/daily-psk.local.rsc
@@ -22,7 +22,7 @@
:global Identity;
:global FormatLine;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
@@ -67,12 +67,12 @@
:local Skip 0;
:if ($NewPsk != $OldPsk) do={
- $LogPrintExit2 info $ScriptName ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")") false;
+ $LogPrint info $ScriptName ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")");
/interface/wireless/access-list/set $AccList private-pre-shared-key=$NewPsk;
:if ([ :len [ /interface/wireless/find where name=$IntName !disabled ] ] = 1) do={
:if ($Seen->$Ssid = 1) do={
- $LogPrintExit2 debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;
+ $LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
} else={
:local Link ($DailyPskQrCodeUrl . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
diff --git a/daily-psk.template.rsc b/daily-psk.template.rsc
index 4403fe6..e190ffb 100644
--- a/daily-psk.template.rsc
+++ b/daily-psk.template.rsc
@@ -23,7 +23,7 @@
:global Identity;
:global FormatLine;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
@@ -79,7 +79,7 @@
:local Skip 0;
:if ($NewPsk != $OldPsk) do={
- $LogPrintExit2 info $ScriptName ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")") false;
+ $LogPrint info $ScriptName ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")");
/caps-man/access-list/set $AccList private-passphrase=$NewPsk;
/interface/wifi/access-list/set $AccList passphrase=$NewPsk;
/interface/wireless/access-list/set $AccList private-pre-shared-key=$NewPsk;
@@ -88,7 +88,7 @@
:if ([ :len [ /interface/wifi/actual-configuration/find where configuration.ssid=$Ssid ] ] > 0) do={
:if ([ :len [ /interface/wireless/find where name=$IntName !disabled ] ] = 1) do={
:if ($Seen->$Ssid = 1) do={
- $LogPrintExit2 debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;
+ $LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
} else={
:local Link ($DailyPskQrCodeUrl . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
diff --git a/daily-psk.wifi.rsc b/daily-psk.wifi.rsc
index e9b5199..ee3e1b0 100644
--- a/daily-psk.wifi.rsc
+++ b/daily-psk.wifi.rsc
@@ -22,7 +22,7 @@
:global Identity;
:global FormatLine;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
@@ -68,12 +68,12 @@
:local Skip 0;
:if ($NewPsk != $OldPsk) do={
- $LogPrintExit2 info $ScriptName ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")") false;
+ $LogPrint info $ScriptName ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")");
/interface/wifi/access-list/set $AccList passphrase=$NewPsk;
:if ([ :len [ /interface/wifi/actual-configuration/find where configuration.ssid=$Ssid ] ] > 0) do={
:if ($Seen->$Ssid = 1) do={
- $LogPrintExit2 debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;
+ $LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
} else={
:local Link ($DailyPskQrCodeUrl . \
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
diff --git a/dhcp-lease-comment.capsman.rsc b/dhcp-lease-comment.capsman.rsc
index 1b61167..4ac228b 100644
--- a/dhcp-lease-comment.capsman.rsc
+++ b/dhcp-lease-comment.capsman.rsc
@@ -17,7 +17,7 @@
:do {
:local ScriptName [ :jobname ];
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
@@ -32,7 +32,7 @@
:set NewComment [ /caps-man/access-list/get $AccessList comment ];
}
:if ([ :len $NewComment ] != 0 && $LeaseVal->"comment" != $NewComment) do={
- $LogPrintExit2 info $ScriptName ("Updating comment for DHCP lease " . $LeaseVal->"active-mac-address" . ": " . $NewComment) false;
+ $LogPrint info $ScriptName ("Updating comment for DHCP lease " . $LeaseVal->"active-mac-address" . ": " . $NewComment);
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
}
}
diff --git a/dhcp-lease-comment.local.rsc b/dhcp-lease-comment.local.rsc
index 5401a77..a49f74f 100644
--- a/dhcp-lease-comment.local.rsc
+++ b/dhcp-lease-comment.local.rsc
@@ -17,7 +17,7 @@
:do {
:local ScriptName [ :jobname ];
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
@@ -32,7 +32,7 @@
:set NewComment [ /interface/wireless/access-list/get $AccessList comment ];
}
:if ([ :len $NewComment ] != 0 && $LeaseVal->"comment" != $NewComment) do={
- $LogPrintExit2 info $ScriptName ("Updating comment for DHCP lease " . $LeaseVal->"active-mac-address" . ": " . $NewComment) false;
+ $LogPrint info $ScriptName ("Updating comment for DHCP lease " . $LeaseVal->"active-mac-address" . ": " . $NewComment);
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
}
}
diff --git a/dhcp-lease-comment.template.rsc b/dhcp-lease-comment.template.rsc
index 6ed8fc3..0f0975b 100644
--- a/dhcp-lease-comment.template.rsc
+++ b/dhcp-lease-comment.template.rsc
@@ -18,7 +18,7 @@
:do {
:local ScriptName [ :jobname ];
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
@@ -37,7 +37,7 @@
:set NewComment [ /interface/wireless/access-list/get $AccessList comment ];
}
:if ([ :len $NewComment ] != 0 && $LeaseVal->"comment" != $NewComment) do={
- $LogPrintExit2 info $ScriptName ("Updating comment for DHCP lease " . $LeaseVal->"active-mac-address" . ": " . $NewComment) false;
+ $LogPrint info $ScriptName ("Updating comment for DHCP lease " . $LeaseVal->"active-mac-address" . ": " . $NewComment);
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
}
}
diff --git a/dhcp-lease-comment.wifi.rsc b/dhcp-lease-comment.wifi.rsc
index 62ed03d..c9c091b 100644
--- a/dhcp-lease-comment.wifi.rsc
+++ b/dhcp-lease-comment.wifi.rsc
@@ -17,7 +17,7 @@
:do {
:local ScriptName [ :jobname ];
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
@@ -32,7 +32,7 @@
:set NewComment [ /interface/wifi/access-list/get $AccessList comment ];
}
:if ([ :len $NewComment ] != 0 && $LeaseVal->"comment" != $NewComment) do={
- $LogPrintExit2 info $ScriptName ("Updating comment for DHCP lease " . $LeaseVal->"active-mac-address" . ": " . $NewComment) false;
+ $LogPrint info $ScriptName ("Updating comment for DHCP lease " . $LeaseVal->"active-mac-address" . ": " . $NewComment);
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
}
}
diff --git a/dhcp-to-dns.rsc b/dhcp-to-dns.rsc
index d0638c7..5b6e64a 100644
--- a/dhcp-to-dns.rsc
+++ b/dhcp-to-dns.rsc
@@ -21,7 +21,7 @@
:global CleanName;
:global EitherOr;
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global LogPrintOnce;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -36,7 +36,7 @@
:if ([ :len [ /ip/dns/static/find where (name=$CommentString or (comment=$CommentString and name=-)) type=NXDOMAIN disabled ] ] = 0) do={
/ip/dns/static/add name=$CommentString type=NXDOMAIN disabled=yes;
- $LogPrintExit2 warning $ScriptName ("Added disabled static dns record with name '" . $CommentString . "'.") false;
+ $LogPrint warning $ScriptName ("Added disabled static dns record with name '" . $CommentString . "'.");
}
:local PlaceBefore ([ /ip/dns/static/find where (name=$CommentString or (comment=$CommentString and name=-)) type=NXDOMAIN disabled ]->0);
@@ -47,10 +47,10 @@
:if ([ :len [ /ip/dhcp-server/lease/find where active-mac-address=($DnsRecordInfo->"macaddress") \
active-address=($DnsRecordVal->"address") server=($DnsRecordInfo->"server") status=bound ] ] > 0) do={
- $LogPrintExit2 debug $ScriptName ("Lease for " . $MacInServer . " (" . $DnsRecordVal->"name" . ") still exists. Not deleting record.") false;
+ $LogPrint debug $ScriptName ("Lease for " . $MacInServer . " (" . $DnsRecordVal->"name" . ") still exists. Not deleting record.");
} else={
:local Found false;
- $LogPrintExit2 info $ScriptName ("Lease expired for " . $MacInServer . ", deleting record (" . $DnsRecordVal->"name" . ").") false;
+ $LogPrint info $ScriptName ("Lease expired for " . $MacInServer . ", deleting record (" . $DnsRecordVal->"name" . ").");
/ip/dns/static/remove $DnsRecord;
/ip/dns/static/remove [ find where type=CNAME comment=($DnsRecordVal->"comment") ];
}
@@ -64,7 +64,7 @@
$LogPrintOnce info $ScriptName ("Multiple bound leases found for mac-address " . ($LeaseVal->"active-mac-address") . "!");
}
} on-error={
- $LogPrintExit2 debug $ScriptName ("A lease just vanished, ignoring.") false;
+ $LogPrint debug $ScriptName ("A lease just vanished, ignoring.");
}
:if ([ :len ($LeaseVal->"active-address") ] > 0) do={
@@ -88,9 +88,9 @@
:local DnsRecordVal [ /ip/dns/static/get $DnsRecord ];
:if ($DnsRecordVal->"address" = $LeaseVal->"active-address" && $DnsRecordVal->"name" = $FullA) do={
- $LogPrintExit2 debug $ScriptName ("The A record for " . $MacInServer . " (" . $FullA . ") does not need updating.") false;
+ $LogPrint debug $ScriptName ("The A record for " . $MacInServer . " (" . $FullA . ") does not need updating.");
} else={
- $LogPrintExit2 info $ScriptName ("Updating A record for " . $MacInServer . " (" . $FullA . " -> " . $LeaseVal->"active-address" . ").") false;
+ $LogPrint info $ScriptName ("Updating A record for " . $MacInServer . " (" . $FullA . " -> " . $LeaseVal->"active-address" . ").");
/ip/dns/static/set address=($LeaseVal->"active-address") name=$FullA $DnsRecord;
}
@@ -98,20 +98,20 @@
:if ([ :len $CName ] > 0) do={
:local CNameVal [ /ip/dns/static/get $CName ];
:if ($CNameVal->"name" != $FullCN || $CNameVal->"cname" != $FullA) do={
- $LogPrintExit2 info $ScriptName ("Deleting CNAME record with wrong data for " . $MacInServer . ".") false;
+ $LogPrint info $ScriptName ("Deleting CNAME record with wrong data for " . $MacInServer . ".");
/ip/dns/static/remove $CName;
}
}
:if ([ :len $HostName ] > 0 && [ :len [ /ip/dns/static/find where name=$FullCN type=CNAME ] ] = 0) do={
- $LogPrintExit2 info $ScriptName ("Adding CNAME record for " . $MacInServer . " (" . $FullCN . " -> " . $FullA . ").") false;
+ $LogPrint info $ScriptName ("Adding CNAME record for " . $MacInServer . " (" . $FullCN . " -> " . $FullA . ").");
/ip/dns/static/add name=$FullCN type=CNAME cname=$FullA ttl=$Ttl comment=$Comment place-before=$PlaceBefore;
}
} else={
- $LogPrintExit2 info $ScriptName ("Adding A record for " . $MacInServer . " (" . $FullA . " -> " . $LeaseVal->"active-address" . ").") false;
+ $LogPrint info $ScriptName ("Adding A record for " . $MacInServer . " (" . $FullA . " -> " . $LeaseVal->"active-address" . ").");
/ip/dns/static/add name=$FullA type=A address=($LeaseVal->"active-address") ttl=$Ttl comment=$Comment place-before=$PlaceBefore;
:if ([ :len $HostName ] > 0 && [ :len [ /ip/dns/static/find where name=$FullCN type=CNAME ] ] = 0) do={
- $LogPrintExit2 info $ScriptName ("Adding CNAME record for " . $MacInServer . " (" . $FullCN . " -> " . $FullA . ").") false;
+ $LogPrint info $ScriptName ("Adding CNAME record for " . $MacInServer . " (" . $FullCN . " -> " . $FullA . ").");
/ip/dns/static/add name=$FullCN type=CNAME cname=$FullA ttl=$Ttl comment=$Comment place-before=$PlaceBefore;
}
}
@@ -120,7 +120,7 @@
$LogPrintOnce warning $ScriptName ("The name '" . $FullA . "' appeared in more than one A record!");
}
} else={
- $LogPrintExit2 debug $ScriptName ("No address available... Ignoring.") false;
+ $LogPrint debug $ScriptName ("No address available... Ignoring.");
}
}
} on-error={ }
diff --git a/firmware-upgrade-reboot.rsc b/firmware-upgrade-reboot.rsc
index 6499d27..038f74e 100644
--- a/firmware-upgrade-reboot.rsc
+++ b/firmware-upgrade-reboot.rsc
@@ -14,7 +14,7 @@
:do {
:local ScriptName [ :jobname ];
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:global VersionToNum;
@@ -24,18 +24,18 @@
:local RouterBoard [ /system/routerboard/get ];
:if ($RouterBoard->"current-firmware" = $RouterBoard->"upgrade-firmware") do={
- $LogPrintExit2 info $ScriptName ("Current and upgrade firmware match with version " . \
- $RouterBoard->"current-firmware" . ".") false;
+ $LogPrint info $ScriptName ("Current and upgrade firmware match with version " . \
+ $RouterBoard->"current-firmware" . ".");
:error true;
}
:if ([ $VersionToNum ($RouterBoard->"current-firmware") ] > [ $VersionToNum ($RouterBoard->"upgrade-firmware") ]) do={
- $LogPrintExit2 info $ScriptName ("Different firmware version is available, but it is a downgrade. Ignoring.") false;
+ $LogPrint info $ScriptName ("Different firmware version is available, but it is a downgrade. Ignoring.");
:error true;
}
:if ([ /system/routerboard/settings/get auto-upgrade ] = false) do={
- $LogPrintExit2 info $ScriptName ("Firmware version " . $RouterBoard->"upgrade-firmware" . \
- " is available, upgrading.") false;
+ $LogPrint info $ScriptName ("Firmware version " . $RouterBoard->"upgrade-firmware" . \
+ " is available, upgrading.");
/system/routerboard/upgrade;
}
@@ -49,6 +49,6 @@
:delay $Uptime;
}
- $LogPrintExit2 info $ScriptName ("Firmware upgrade successful, rebooting.") false;
+ $LogPrint info $ScriptName ("Firmware upgrade successful, rebooting.");
/system/reboot;
} on-error={ }
diff --git a/fw-addr-lists.rsc b/fw-addr-lists.rsc
index 4ec4105..64233ac 100644
--- a/fw-addr-lists.rsc
+++ b/fw-addr-lists.rsc
@@ -20,7 +20,7 @@
:global CertificateAvailable;
:global EitherOr;
- :global LogPrintExit2;
+ :global LogPrint;
:global LogPrintOnce;
:global ScriptLock;
:global WaitFullyConnected;
@@ -57,7 +57,7 @@
:if ([ :len ($List->"cert") ] > 0) do={
:set CheckCertificate "yes-without-crl";
:if ([ $CertificateAvailable ($List->"cert") ] = false) do={
- $LogPrintExit2 warning $ScriptName ("Downloading required certificate failed, trying anyway.") false;
+ $LogPrint warning $ScriptName ("Downloading required certificate failed, trying anyway.");
}
}
@@ -68,7 +68,7 @@
http-header-field=({ $FetchUserAgent }) ($List->"url") as-value ]->"data");
} on-error={
:if ($I < 4) do={
- $LogPrintExit2 debug $ScriptName ("Failed downloading, " . $I . ". try: " . $List->"url") false;
+ $LogPrint debug $ScriptName ("Failed downloading, " . $I . ". try: " . $List->"url");
:delay (($I * $I) . "s");
}
}
@@ -78,7 +78,7 @@
:if ($Data = false) do={
:set Data "";
:set Failure true;
- $LogPrintExit2 warning $ScriptName ("Failed downloading list from: " . $List->"url") false;
+ $LogPrint warning $ScriptName ("Failed downloading list from: " . $List->"url");
}
:if ([ :len $Data ] > 63000) do={
@@ -103,13 +103,13 @@
:foreach Entry in=[ /ip/firewall/address-list/find where list=$FwListName comment=$ListComment ] do={
:local Address [ /ip/firewall/address-list/get $Entry address ];
:if ([ :typeof ($IPv4Addresses->$Address) ] = "time") do={
- $LogPrintExit2 debug $ScriptName ("Renewing IPv4 address for " . ($IPv4Addresses->$Address) . ": " . $Address) false;
+ $LogPrint debug $ScriptName ("Renewing IPv4 address for " . ($IPv4Addresses->$Address) . ": " . $Address);
/ip/firewall/address-list/set $Entry timeout=($IPv4Addresses->$Address);
:set ($IPv4Addresses->$Address);
:set CntRenew ($CntRenew + 1);
} else={
:if ($Failure = false) do={
- $LogPrintExit2 debug $ScriptName ("Removing IPv4 address: " . $Address) false;
+ $LogPrint debug $ScriptName ("Removing IPv4 address: " . $Address);
/ip/firewall/address-list/remove $Entry;
:set CntRemove ($CntRemove + 1);
}
@@ -119,13 +119,13 @@
:foreach Entry in=[ /ipv6/firewall/address-list/find where list=$FwListName comment=$ListComment ] do={
:local Address [ /ipv6/firewall/address-list/get $Entry address ];
:if ([ :typeof ($IPv6Addresses->$Address) ] = "time") do={
- $LogPrintExit2 debug $ScriptName ("Renewing IPv6 address for " . ($IPv6Addresses->$Address) . ": " . $Address) false;
+ $LogPrint debug $ScriptName ("Renewing IPv6 address for " . ($IPv6Addresses->$Address) . ": " . $Address);
/ipv6/firewall/address-list/set $Entry timeout=($IPv6Addresses->$Address);
:set ($IPv6Addresses->$Address);
:set CntRenew ($CntRenew + 1);
} else={
:if ($Failure = false) do={
- $LogPrintExit2 debug $ScriptName ("Removing: " . $Address) false;
+ $LogPrint debug $ScriptName ("Removing: " . $Address);
/ipv6/firewall/address-list/remove $Entry;
:set CntRemove ($CntRemove + 1);
}
@@ -133,27 +133,27 @@
}
:foreach Address,Timeout in=$IPv4Addresses do={
- $LogPrintExit2 debug $ScriptName ("Adding IPv4 address for " . $Timeout . ": " . $Address) false;
+ $LogPrint debug $ScriptName ("Adding IPv4 address for " . $Timeout . ": " . $Address);
:do {
/ip/firewall/address-list/add list=$FwListName comment=$ListComment address=$Address timeout=$Timeout;
:set ($IPv4Addresses->$Address);
:set CntAdd ($CntAdd + 1);
} on-error={
- $LogPrintExit2 warning $ScriptName ("Failed to add IPv4 address " . $Address . " to list '" . $FwListName . "'.") false;
+ $LogPrint warning $ScriptName ("Failed to add IPv4 address " . $Address . " to list '" . $FwListName . "'.");
}
}
:foreach Address,Timeout in=$IPv6Addresses do={
- $LogPrintExit2 debug $ScriptName ("Adding IPv6 address for " . $Timeout . ": " . $Address) false;
+ $LogPrint debug $ScriptName ("Adding IPv6 address for " . $Timeout . ": " . $Address);
:do {
/ipv6/firewall/address-list/add list=$FwListName comment=$ListComment address=$Address timeout=$Timeout;
:set ($IPv6Addresses->$Address);
:set CntAdd ($CntAdd + 1);
} on-error={
- $LogPrintExit2 warning $ScriptName ("Failed to add IPv6 address " . $Address . " to list '" . $FwListName . "'.") false;
+ $LogPrint warning $ScriptName ("Failed to add IPv6 address " . $Address . " to list '" . $FwListName . "'.");
}
}
- $LogPrintExit2 info $ScriptName ("list: " . $FwListName . " -- added: " . $CntAdd . " - renewed: " . $CntRenew . " - removed: " . $CntRemove) false;
+ $LogPrint info $ScriptName ("list: " . $FwListName . " -- added: " . $CntAdd . " - renewed: " . $CntRenew . " - removed: " . $CntRemove);
}
} on-error={ }
diff --git a/global-functions.rsc b/global-functions.rsc
index aca4cd8..d33e3e2 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -12,7 +12,7 @@
:local ScriptName [ :jobname ];
# expected configuration version
-:global ExpectedConfigVersion 122;
+:global ExpectedConfigVersion 123;
# global variables not to be changed by user
:global GlobalFunctionsReady false;
@@ -53,6 +53,7 @@
:global IsFullyConnected;
:global IsMacLocallyAdministered;
:global IsTimeSync;
+:global LogPrint;
:global LogPrintExit2;
:global LogPrintOnce;
:global MAX;
@@ -101,18 +102,18 @@
:local CommonName [ :tostr $1 ];
:global CertificateDownload;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:if ([ /system/resource/get free-hdd-space ] < 8388608 && \
[ /certificate/settings/get crl-download ] = true && \
[ /certificate/settings/get crl-store ] = "system") do={
- $LogPrintExit2 warning $0 ("This system has low free flash space but " . \
- "is configured to download certificate CRLs to system!") false;
+ $LogPrint warning $0 ("This system has low free flash space but " . \
+ "is configured to download certificate CRLs to system!");
}
:if ([ :len [ /certificate/find where common-name=$CommonName ] ] = 0) do={
- $LogPrintExit2 info $0 ("Certificate with CommonName \"" . $CommonName . "\" not available.") false;
+ $LogPrint info $0 ("Certificate with CommonName \"" . $CommonName . "\" not available.");
:if ([ $CertificateDownload $CommonName ] = false) do={
:return false;
}
@@ -121,8 +122,8 @@
:local CertVal [ /certificate/get [ find where common-name=$CommonName ] ];
:while (($CertVal->"akid") != "" && ($CertVal->"akid") != ($CertVal->"skid")) do={
:if ([ :len [ /certificate/find where skid=($CertVal->"akid") ] ] = 0) do={
- $LogPrintExit2 info $0 ("Certificate chain for \"" . $CommonName . \
- "\" is incomplete, missing \"" . ([ $ParseKeyValueStore ($CertVal->"issuer") ]->"CN") . "\".") false;
+ $LogPrint info $0 ("Certificate chain for \"" . $CommonName . \
+ "\" is incomplete, missing \"" . ([ $ParseKeyValueStore ($CertVal->"issuer") ]->"CN") . "\".");
:if ([ $CertificateDownload $CommonName ] = false) do={
:return false;
}
@@ -141,12 +142,12 @@
:global ScriptUpdatesUrlSuffix;
:global CertificateNameByCN;
- :global LogPrintExit2;
+ :global LogPrint;
:global UrlEncode;
:global WaitForFile;
- $LogPrintExit2 info $0 ("Downloading and importing certificate with " . \
- "CommonName \"" . $CommonName . "\".") false;
+ $LogPrint info $0 ("Downloading and importing certificate with " . \
+ "CommonName \"" . $CommonName . "\".");
:do {
:local LocalFileName ($CommonName . ".pem");
:local UrlFileName ([ $UrlEncode $CommonName ] . ".pem");
@@ -162,8 +163,7 @@
$CertificateNameByCN [ /certificate/get $Cert common-name ];
}
} on-error={
- $LogPrintExit2 warning $0 ("Failed importing certificate with " . \
- "CommonName \"" . $CommonName . "\"!") false;
+ $LogPrint warning $0 ("Failed importing certificate with CommonName \"" . $CommonName . "\"!");
:return false;
}
:return true;
@@ -308,7 +308,7 @@
:global CertificateAvailable;
:global CleanFilePath;
- :global LogPrintExit2;
+ :global LogPrint;
:global MkDir;
:global WaitForFile;
@@ -323,23 +323,23 @@
:local PkgDest [ $CleanFilePath ($PkgDir . "/" . $PkgFile) ];
:if ([ $MkDir $PkgDir ] = false) do={
- $LogPrintExit2 warning $0 ("Failed creating directory, not downloading package.") false;
+ $LogPrint warning $0 ("Failed creating directory, not downloading package.");
:return false;
}
:if ([ :len [ /file/find where name=$PkgDest type="package" ] ] > 0) do={
- $LogPrintExit2 info $0 ("Package file " . $PkgName . " already exists.") false;
+ $LogPrint info $0 ("Package file " . $PkgName . " already exists.");
:return true;
}
:if ([ $CertificateAvailable "R3" ] = false) do={
- $LogPrintExit2 error $0 ("Downloading required certificate failed.") false;
+ $LogPrint error $0 ("Downloading required certificate failed.");
:return false;
}
:local Url ("https://upgrade.mikrotik.com/routeros/" . $PkgVer . "/" . $PkgFile);
- $LogPrintExit2 info $0 ("Downloading package file '" . $PkgName . "'...") false;
- $LogPrintExit2 debug $0 ("... from url: " . $Url) false;
+ $LogPrint info $0 ("Downloading package file '" . $PkgName . "'...");
+ $LogPrint debug $0 ("... from url: " . $Url);
:local Retry 3;
:while ($Retry > 0) do={
:do {
@@ -350,14 +350,14 @@
:return true;
}
} on-error={
- $LogPrintExit2 debug $0 ("Downloading package file failed.") false;
+ $LogPrint debug $0 ("Downloading package file failed.");
}
/file/remove [ find where name=$PkgDest ];
:set Retry ($Retry - 1);
}
- $LogPrintExit2 warning $0 ("Downloading package file '" . $PkgName . "' failed.") false;
+ $LogPrint warning $0 ("Downloading package file '" . $PkgName . "' failed.");
:return false;
}
@@ -443,7 +443,7 @@
:global CertificateAvailable;
:global IsMacLocallyAdministered;
- :global LogPrintExit2;
+ :global LogPrint;
:if ([ $IsMacLocallyAdministered $Mac ] = true) do={
:return "locally administered";
@@ -451,7 +451,8 @@
:do {
:if ([ $CertificateAvailable "GTS CA 1P5" ] = false) do={
- $LogPrintExit2 warning $0 ("Downloading required certificate failed.") true;
+ $LogPrint warning $0 ("Downloading required certificate failed.");
+ :error false;
}
:local Vendor ([ /tool/fetch check-certificate=yes-without-crl \
("https://api.macvendors.com/" . [ :pick $Mac 0 8 ]) output=user as-value ]->"data");
@@ -460,9 +461,9 @@
:do {
/tool/fetch check-certificate=yes-without-crl ("https://api.macvendors.com/") \
output=none as-value;
- $LogPrintExit2 debug $0 ("The mac vendor is not known in database.") false;
+ $LogPrint debug $0 ("The mac vendor is not known in database.");
} on-error={
- $LogPrintExit2 warning $0 ("Failed getting mac vendor.") false;
+ $LogPrint warning $0 ("Failed getting mac vendor.");
}
:return "unknown vendor";
}
@@ -609,7 +610,7 @@
:global IsTimeSyncCached;
:global IsTimeSyncResetNtp;
- :global LogPrintExit2;
+ :global LogPrint;
:if ($IsTimeSyncCached = true) do={
:return true;
@@ -638,7 +639,7 @@
:if ([ /system/license/get ]->"level" = "free" || \
[ /system/resource/get ]->"board-name" = "x86") do={
- $LogPrintExit2 debug $0 ("No ntp client configured, relying on RTC for CHR free license and x86.") false;
+ $LogPrint debug $0 ("No ntp client configured, relying on RTC for CHR free license and x86.");
:return true;
}
@@ -650,16 +651,15 @@
:return false;
}
- $LogPrintExit2 debug $0 ("No time source configured! Returning gracefully...") false;
+ $LogPrint debug $0 ("No time source configured! Returning gracefully...");
:return true;
}
-# log and print with same text, optionally exit
-:set LogPrintExit2 do={
+# log and print with same text
+:set LogPrint do={
:local Severity [ :tostr $1 ];
:local Name [ :tostr $2 ];
:local Message [ :tostr $3 ];
- :local Exit [ :tostr $4 ];
:global PrintDebug;
:global PrintDebugOverride;
@@ -692,6 +692,19 @@
:if ($Severity != "debug" || $Debug = true) do={
:put ([ $PrintSeverity $Severity ] . ": " . $Message);
}
+}
+
+# log and print with same text, optionally exit
+# Deprectated! - TODO: remove later
+:set LogPrintExit2 do={
+ :local Severity [ :tostr $1 ];
+ :local Name [ :tostr $2 ];
+ :local Message [ :tostr $3 ];
+ :local Exit [ :tostr $4 ];
+
+ :global LogPrint;
+
+ $LogPrint $1 $2 $3;
:if ($Exit = "true") do={
:error ("Hard error to exit.");
@@ -704,7 +717,7 @@
:local Name [ :tostr $2 ];
:local Message [ :tostr $3 ];
- :global LogPrintExit2;
+ :global LogPrint;
:global LogPrintOnceMessages;
@@ -717,7 +730,7 @@
}
:set ($LogPrintOnceMessages->$Message) 1;
- $LogPrintExit2 $Severity $Name $Message false;
+ $LogPrint $Severity $Name $Message;
}
# get max value
@@ -737,24 +750,24 @@
:local Path [ :tostr $1 ];
:global CleanFilePath;
- :global LogPrintExit2;
+ :global LogPrint;
:global WaitForFile;
:local MkTmpfs do={
- :global LogPrintExit2;
+ :global LogPrint;
:global WaitForFile;
:if ([ :len [ /disk/find where slot=tmpfs type=tmpfs ] ] = 1) do={
:return true;
}
- $LogPrintExit2 info $0 ("Creating disk of type tmpfs.") false;
+ $LogPrint info $0 ("Creating disk of type tmpfs.");
/file/remove [ find where name="tmpfs" type="directory" ];
:do {
/disk/add slot=tmpfs type=tmpfs tmpfs-max-size=([ /system/resource/get total-memory ] / 3);
$WaitForFile "tmpfs";
} on-error={
- $LogPrintExit2 warning $0 ("Creating disk of type tmpfs failed!") false;
+ $LogPrint warning $0 ("Creating disk of type tmpfs failed!");
:return false;
}
:return true;
@@ -782,7 +795,7 @@
$WaitForFile $File;
/file/remove $File;
} on-error={
- $LogPrintExit2 warning $0 ("Making directory '" . $Path . "' failed!") false;
+ $LogPrint warning $0 ("Making directory '" . $Path . "' failed!");
:return false;
}
@@ -913,18 +926,18 @@
:local Warn [ :tostr $3 ];
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global VersionToNum;
:if (!($Required ~ "^\\d+\\.\\d+((alpha|beta|rc|\\.)\\d+|)\$")) do={
- $LogPrintExit2 error $0 ("No valid RouterOS version: " . $Required) false;
+ $LogPrint error $0 ("No valid RouterOS version: " . $Required);
:return false;
}
:if ([ $VersionToNum $Required ] > [ $VersionToNum [ /system/package/update/get installed-version ] ]) do={
:if ($Warn = "true") do={
- $LogPrintExit2 warning $0 ("This " . [ $IfThenElse ([ :pick $Caller 0 ] = ("\$")) "function" "script" ] . \
- " '" . $Caller . "' (at least specific functionality) requires RouterOS " . $Required . ". Please update!") false;
+ $LogPrint warning $0 ("This " . [ $IfThenElse ([ :pick $Caller 0 ] = ("\$")) "function" "script" ] . \
+ " '" . $Caller . "' (at least specific functionality) requires RouterOS " . $Required . ". Please update!");
}
:return false;
}
@@ -935,7 +948,7 @@
:set ScriptFromTerminal do={
:local Script [ :tostr $1 ];
- :global LogPrintExit2;
+ :global LogPrint;
:foreach Job in=[ /system/script/job/find where script=$Script ] do={
:set Job [ /system/script/job/get $Job ];
@@ -943,11 +956,11 @@
:set Job [ /system/script/job/get [ find where .id=($Job->"parent") ] ];
}
:if (($Job->"type") = "login") do={
- $LogPrintExit2 debug $0 ("Script " . $Script . " started from terminal.") false;
+ $LogPrint debug $0 ("Script " . $Script . " started from terminal.");
:return true;
}
}
- $LogPrintExit2 debug $0 ("Script " . $Script . " NOT started from terminal.") false;
+ $LogPrint debug $0 ("Script " . $Script . " NOT started from terminal.");
:return false;
}
@@ -969,7 +982,7 @@
:global EitherOr;
:global Grep;
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global LogPrintOnce;
:global ParseKeyValueStore;
:global RequiredRouterOS;
@@ -978,12 +991,12 @@
:global ValidateSyntax;
:if ([ $CertificateAvailable "E1" ] = false) do={
- $LogPrintExit2 warning $0 ("Downloading certificate failed, trying without.") false;
+ $LogPrint warning $0 ("Downloading certificate failed, trying without.");
}
:foreach Script in=$Scripts do={
:if ([ :len [ /system/script/find where name=$Script ] ] = 0) do={
- $LogPrintExit2 info $0 ("Adding new script: " . $Script) false;
+ $LogPrint info $0 ("Adding new script: " . $Script);
/system/script/add name=$Script owner=$Script source="#!rsc by RouterOS\n" comment=$NewComment;
}
}
@@ -1000,8 +1013,8 @@
: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={
- $LogPrintExit2 warning $0 ("Policies differ for script '" . $ScriptVal->"name" . \
- "' and its scheduler '" . $SchedulerVal->"name" . "'!") false;
+ $LogPrint warning $0 ("Policies differ for script '" . $ScriptVal->"name" . \
+ "' and its scheduler '" . $SchedulerVal->"name" . "'!");
}
}
@@ -1010,7 +1023,7 @@
:local BaseUrl [ $EitherOr ($ScriptInfo->"base-url") $ScriptUpdatesBaseUrl ];
:local UrlSuffix [ $EitherOr ($ScriptInfo->"url-suffix") $ScriptUpdatesUrlSuffix ];
:local Url ($BaseUrl . $ScriptVal->"name" . ".rsc" . $UrlSuffix);
- $LogPrintExit2 debug $0 ("Fetching script '" . $ScriptVal->"name" . "' from url: " . $Url) false;
+ $LogPrint debug $0 ("Fetching script '" . $ScriptVal->"name" . "' from url: " . $Url);
:local Result [ /tool/fetch check-certificate=yes-without-crl \
http-header-field=({ $FetchUserAgent }) $Url output=user as-value ];
:if ($Result->"status" = "finished") do={
@@ -1018,11 +1031,11 @@
}
} on-error={
:if ($ScriptVal->"source" = "#!rsc by RouterOS\n") do={
- $LogPrintExit2 warning $0 ("Failed fetching script '" . $ScriptVal->"name" . \
- "', removing dummy. Typo on installation?") false;
+ $LogPrint warning $0 ("Failed fetching script '" . $ScriptVal->"name" . \
+ "', removing dummy. Typo on installation?");
/system/script/remove $Script;
} else={
- $LogPrintExit2 warning $0 ("Failed fetching script '" . $ScriptVal->"name" . "'!") false;
+ $LogPrint warning $0 ("Failed fetching script '" . $ScriptVal->"name" . "'!");
}
}
}
@@ -1033,7 +1046,7 @@
:local Required ([ $ParseKeyValueStore [ $Grep $SourceNew ("\23 requires RouterOS, ") ] ]->"version");
:if ([ $RequiredRouterOS $0 [ $EitherOr $Required "0.0" ] false ] = true) do={
:if ([ $ValidateSyntax $SourceNew ] = true) do={
- $LogPrintExit2 info $0 ("Updating script: " . $ScriptVal->"name") false;
+ $LogPrint info $0 ("Updating script: " . $ScriptVal->"name");
/system/script/set owner=($ScriptVal->"name") source=$SourceNew $Script;
:if ($ScriptVal->"name" = "global-config") do={
:set ReloadGlobalConfig true;
@@ -1042,48 +1055,48 @@
:set ReloadGlobalFunctions true;
}
} else={
- $LogPrintExit2 warning $0 ("Syntax validation for script '" . $ScriptVal->"name" . \
- "' failed! Ignoring!") false;
+ $LogPrint warning $0 ("Syntax validation for script '" . $ScriptVal->"name" . \
+ "' failed! Ignoring!");
}
} else={
$LogPrintOnce warning $0 ("The script '" . $ScriptVal->"name" . "' requires RouterOS " . \
$Required . ", which is not met by your installation. Ignoring!");
}
} else={
- $LogPrintExit2 warning $0 ("Looks like new script '" . $ScriptVal->"name" . \
- "' is not valid (missing shebang). Ignoring!") false;
+ $LogPrint warning $0 ("Looks like new script '" . $ScriptVal->"name" . \
+ "' is not valid (missing shebang). Ignoring!");
}
} else={
- $LogPrintExit2 debug $0 ("Script '" . $ScriptVal->"name" . "' did not change.") false;
+ $LogPrint debug $0 ("Script '" . $ScriptVal->"name" . "' did not change.");
}
} else={
- $LogPrintExit2 debug $0 ("No update for script '" . $ScriptVal->"name" . "'.") false;
+ $LogPrint debug $0 ("No update for script '" . $ScriptVal->"name" . "'.");
}
}
:if ($ReloadGlobalFunctions = true) do={
- $LogPrintExit2 info $0 ("Reloading global functions.") false;
+ $LogPrint info $0 ("Reloading global functions.");
:do {
/system/script/run global-functions;
} on-error={
- $LogPrintExit2 error $0 ("Reloading global functions failed!") false;
+ $LogPrint error $0 ("Reloading global functions failed!");
}
}
:if ($ReloadGlobalConfig = true) do={
- $LogPrintExit2 info $0 ("Reloading global configuration.") false;
+ $LogPrint info $0 ("Reloading global configuration.");
:do {
/system/script/run global-config;
} on-error={
- $LogPrintExit2 error $0 ("Reloading global configuration failed!" . \
- " Syntax error or missing overlay?") false;
+ $LogPrint error $0 ("Reloading global configuration failed!" . \
+ " Syntax error or missing overlay?");
}
}
:if ($ExpectedConfigVersionBefore > $ExpectedConfigVersion) do={
- $LogPrintExit2 warning $0 ("The configuration version decreased from " . \
+ $LogPrint warning $0 ("The configuration version decreased from " . \
$ExpectedConfigVersionBefore . " to " . $ExpectedConfigVersion . \
- ". Installed an older version?") false;
+ ". Installed an older version?");
}
:if ($ExpectedConfigVersionBefore < $ExpectedConfigVersion) do={
@@ -1093,14 +1106,14 @@
:do {
:local Url ($ScriptUpdatesBaseUrl . "news-and-changes.rsc" . $ScriptUpdatesUrlSuffix);
- $LogPrintExit2 debug $0 ("Fetching news, changes and migration: " . $Url) false;
+ $LogPrint debug $0 ("Fetching news, changes and migration: " . $Url);
:local Result [ /tool/fetch check-certificate=yes-without-crl \
http-header-field=({ $FetchUserAgent }) $Url output=user as-value ];
:if ($Result->"status" = "finished") do={
:set ChangeLogCode ($Result->"data");
}
} on-error={
- $LogPrintExit2 warning $0 ("Failed fetching news, changes and migration!") false;
+ $LogPrint warning $0 ("Failed fetching news, changes and migration!");
}
:if ([ :len $ChangeLogCode ] > 0) do={
@@ -1108,10 +1121,10 @@
:do {
[ :parse $ChangeLogCode ];
} on-error={
- $LogPrintExit2 warning $0 ("The changelog failed to run!") false;
+ $LogPrint warning $0 ("The changelog failed to run!");
}
} else={
- $LogPrintExit2 warning $0 ("The changelog failed syntax validation!") false;
+ $LogPrint warning $0 ("The changelog failed syntax validation!");
}
}
@@ -1120,14 +1133,14 @@
:local Migration ($GlobalConfigMigration->[ :tostr $I ]);
:if ([ :typeof $Migration ] = "str") do={
:if ([ $ValidateSyntax $Migration ] = true) do={
- $LogPrintExit2 info $0 ("Applying migration for change " . $I . ": " . $Migration) false;
+ $LogPrint info $0 ("Applying migration for change " . $I . ": " . $Migration);
:do {
[ :parse $Migration ];
} on-error={
- $LogPrintExit2 warning $0 ("Migration code for change " . $I . " failed to run!") false;
+ $LogPrint warning $0 ("Migration code for change " . $I . " failed to run!");
}
} else={
- $LogPrintExit2 warning $0 ("Migration code for change " . $I . " failed syntax validation!") false;
+ $LogPrint warning $0 ("Migration code for change " . $I . " failed syntax validation!");
}
}
}
@@ -1136,7 +1149,7 @@
:local NotificationMessage ("The configuration version on " . $Identity . " increased " . \
"to " . $ExpectedConfigVersion . ", current configuration may need modification. " . \
"Please review and update global-config-overlay, then re-run global-config.");
- $LogPrintExit2 info $0 ($NotificationMessage) false;
+ $LogPrint info $0 ($NotificationMessage);
:if ([ :len $GlobalConfigChanges ] > 0) do={
:set NotificationMessage ($NotificationMessage . "\n\nChanges:");
@@ -1144,7 +1157,7 @@
:local Change ($GlobalConfigChanges->[ :tostr $I ]);
:set NotificationMessage ($NotificationMessage . "\n " . \
[ $SymbolForNotification "pushpin" "*" ] . $Change);
- $LogPrintExit2 info $0 ("Change " . $I . ": " . $Change) false;
+ $LogPrint info $0 ("Change " . $I . ": " . $Change);
}
} else={
:set NotificationMessage ($NotificationMessage . "\n\nNews and changes are not available.");
@@ -1178,7 +1191,7 @@
:global GetRandom20CharAlNum;
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLockOrder;
:if ([ :typeof $ScriptLockOrder ] = "nothing") do={
@@ -1264,15 +1277,17 @@
}
:if ([ :len [ /system/script/find where name=$Script ] ] = 0) do={
- $LogPrintExit2 error $0 ("A script named '" . $Script . "' does not exist!") true;
+ $LogPrint error $0 ("A script named '" . $Script . "' does not exist!");
+ :error false;
}
:if ([ $JobCount $Script ] = 0) do={
- $LogPrintExit2 error $0 ("No script '" . $Script . "' is running!") true;
+ $LogPrint error $0 ("No script '" . $Script . "' is running!");
+ :error false;
}
:if ([ $TicketCount $Script ] >= [ $JobCount $Script ]) do={
- $LogPrintExit2 error $0 ("More tickets than running scripts '" . $Script . "', resetting!") false;
+ $LogPrint error $0 ("More tickets than running scripts '" . $Script . "', resetting!");
:set ($ScriptLockOrder->$Script) ({});
/system/script/job/remove [ find where script=$Script ];
}
@@ -1293,8 +1308,8 @@
}
$RemoveTicket $Script $MyTicket;
- $LogPrintExit2 info $0 ("Script '" . $Script . "' started more than once" . [ $IfThenElse ($WaitCount > 0) \
- " and timed out waiting for lock" "" ] . "...") false;
+ $LogPrint info $0 ("Script '" . $Script . "' started more than once" . [ $IfThenElse ($WaitCount > 0) \
+ " and timed out waiting for lock" "" ] . "...");
:return false;
}
@@ -1529,10 +1544,10 @@
:do {
/system/script/run $Script;
} on-error={
- $LogPrintExit2 error $0 ("Module '" . $ScriptVal->"name" . "' failed to run.") false;
+ $LogPrint error $0 ("Module '" . $ScriptVal->"name" . "' failed to run.");
}
} else={
- $LogPrintExit2 error $0 ("Module '" . $ScriptVal->"name" . "' failed syntax validation, skipping.") false;
+ $LogPrint error $0 ("Module '" . $ScriptVal->"name" . "' failed syntax validation, skipping.");
}
}
diff --git a/gps-track.rsc b/gps-track.rsc
index c40e2e0..1aeab84 100644
--- a/gps-track.rsc
+++ b/gps-track.rsc
@@ -17,7 +17,7 @@
:global GpsTrackUrl;
:global Identity;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:global WaitFullyConnected;
@@ -38,13 +38,13 @@
"\"lon\":\"" . ($Gps->"longitude") . "\"," . \
"\"identity\":\"" . $Identity . "\"" . \
"}") as-value;
- $LogPrintExit2 debug $ScriptName ("Sending GPS data in " . $CoordinateFormat . " format: " . \
+ $LogPrint debug $ScriptName ("Sending GPS data in " . $CoordinateFormat . " format: " . \
"lat: " . ($Gps->"latitude") . " " . \
- "lon: " . ($Gps->"longitude")) false;
+ "lon: " . ($Gps->"longitude"));
} on-error={
- $LogPrintExit2 warning $ScriptName ("Failed sending GPS data!") false;
+ $LogPrint warning $ScriptName ("Failed sending GPS data!");
}
} else={
- $LogPrintExit2 debug $ScriptName ("GPS data not valid.") false;
+ $LogPrint debug $ScriptName ("GPS data not valid.");
}
} on-error={ }
diff --git a/hotspot-to-wpa-cleanup.capsman.rsc b/hotspot-to-wpa-cleanup.capsman.rsc
index ba74260..0540ad5 100644
--- a/hotspot-to-wpa-cleanup.capsman.rsc
+++ b/hotspot-to-wpa-cleanup.capsman.rsc
@@ -18,7 +18,7 @@
:local ScriptName [ :jobname ];
:global EitherOr;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -41,8 +41,8 @@
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic \
mac-address=($ClientVal->"mac-address") ] do={
:if (($DHCPServers->[ /ip/dhcp-server/lease/get $Lease server ]) > 0s) do={
- $LogPrintExit2 info $ScriptName ("Client with mac address " . ($ClientVal->"mac-address") . \
- " connected to WPA, making lease static.") false;
+ $LogPrint info $ScriptName ("Client with mac address " . ($ClientVal->"mac-address") . \
+ " connected to WPA, making lease static.");
/ip/dhcp-server/lease/make-static $Lease;
/ip/dhcp-server/lease/set comment=($ClientVal->"comment") $Lease;
}
@@ -54,8 +54,8 @@
:local ClientVal [ /caps-man/access-list/get $Client ];
:if ([ :len [ /ip/dhcp-server/lease/find where !dynamic comment~"^hotspot-to-wpa:" \
mac-address=($ClientVal->"mac-address") ] ] = 0) do={
- $LogPrintExit2 info $ScriptName ("Client with mac address " . ($ClientVal->"mac-address") . \
- " did not connect to WPA, removing from access list.") false;
+ $LogPrint info $ScriptName ("Client with mac address " . ($ClientVal->"mac-address") . \
+ " did not connect to WPA, removing from access list.");
/caps-man/access-list/remove $Client;
}
}
@@ -64,8 +64,8 @@
:foreach Lease in=[ /ip/dhcp-server/lease/find where !dynamic status="waiting" \
server=$Server last-seen>$Timeout comment~"^hotspot-to-wpa:" ] do={
:local LeaseVal [ /ip/dhcp-server/lease/get $Lease ];
- $LogPrintExit2 info $ScriptName ("Client with mac address " . ($LeaseVal->"mac-address") . \
- " was not seen for " . ($LeaseVal->"last-seen") . ", removing.") false;
+ $LogPrint info $ScriptName ("Client with mac address " . ($LeaseVal->"mac-address") . \
+ " was not seen for " . ($LeaseVal->"last-seen") . ", removing.");
/caps-man/access-list/remove [ find where comment~"^hotspot-to-wpa:" \
mac-address=($LeaseVal->"mac-address") ];
/ip/dhcp-server/lease/remove $Lease;
diff --git a/hotspot-to-wpa-cleanup.template.rsc b/hotspot-to-wpa-cleanup.template.rsc
index c46d75d..6f3b3e1 100644
--- a/hotspot-to-wpa-cleanup.template.rsc
+++ b/hotspot-to-wpa-cleanup.template.rsc
@@ -19,7 +19,7 @@
:local ScriptName [ :jobname ];
:global EitherOr;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -44,8 +44,8 @@
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic \
mac-address=($ClientVal->"mac-address") ] do={
:if (($DHCPServers->[ /ip/dhcp-server/lease/get $Lease server ]) > 0s) do={
- $LogPrintExit2 info $ScriptName ("Client with mac address " . ($ClientVal->"mac-address") . \
- " connected to WPA, making lease static.") false;
+ $LogPrint info $ScriptName ("Client with mac address " . ($ClientVal->"mac-address") . \
+ " connected to WPA, making lease static.");
/ip/dhcp-server/lease/make-static $Lease;
/ip/dhcp-server/lease/set comment=($ClientVal->"comment") $Lease;
}
@@ -59,8 +59,8 @@
:local ClientVal [ /interface/wifi/access-list/get $Client ];
:if ([ :len [ /ip/dhcp-server/lease/find where !dynamic comment~"^hotspot-to-wpa:" \
mac-address=($ClientVal->"mac-address") ] ] = 0) do={
- $LogPrintExit2 info $ScriptName ("Client with mac address " . ($ClientVal->"mac-address") . \
- " did not connect to WPA, removing from access list.") false;
+ $LogPrint info $ScriptName ("Client with mac address " . ($ClientVal->"mac-address") . \
+ " did not connect to WPA, removing from access list.");
/caps-man/access-list/remove $Client;
/interface/wifi/access-list/remove $Client;
}
@@ -70,8 +70,8 @@
:foreach Lease in=[ /ip/dhcp-server/lease/find where !dynamic status="waiting" \
server=$Server last-seen>$Timeout comment~"^hotspot-to-wpa:" ] do={
:local LeaseVal [ /ip/dhcp-server/lease/get $Lease ];
- $LogPrintExit2 info $ScriptName ("Client with mac address " . ($LeaseVal->"mac-address") . \
- " was not seen for " . ($LeaseVal->"last-seen") . ", removing.") false;
+ $LogPrint info $ScriptName ("Client with mac address " . ($LeaseVal->"mac-address") . \
+ " was not seen for " . ($LeaseVal->"last-seen") . ", removing.");
/caps-man/access-list/remove [ find where comment~"^hotspot-to-wpa:" \
/interface/wifi/access-list/remove [ find where comment~"^hotspot-to-wpa:" \
mac-address=($LeaseVal->"mac-address") ];
diff --git a/hotspot-to-wpa-cleanup.wifi.rsc b/hotspot-to-wpa-cleanup.wifi.rsc
index 3e5799a..9c79628 100644
--- a/hotspot-to-wpa-cleanup.wifi.rsc
+++ b/hotspot-to-wpa-cleanup.wifi.rsc
@@ -18,7 +18,7 @@
:local ScriptName [ :jobname ];
:global EitherOr;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -41,8 +41,8 @@
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic \
mac-address=($ClientVal->"mac-address") ] do={
:if (($DHCPServers->[ /ip/dhcp-server/lease/get $Lease server ]) > 0s) do={
- $LogPrintExit2 info $ScriptName ("Client with mac address " . ($ClientVal->"mac-address") . \
- " connected to WPA, making lease static.") false;
+ $LogPrint info $ScriptName ("Client with mac address " . ($ClientVal->"mac-address") . \
+ " connected to WPA, making lease static.");
/ip/dhcp-server/lease/make-static $Lease;
/ip/dhcp-server/lease/set comment=($ClientVal->"comment") $Lease;
}
@@ -54,8 +54,8 @@
:local ClientVal [ /interface/wifi/access-list/get $Client ];
:if ([ :len [ /ip/dhcp-server/lease/find where !dynamic comment~"^hotspot-to-wpa:" \
mac-address=($ClientVal->"mac-address") ] ] = 0) do={
- $LogPrintExit2 info $ScriptName ("Client with mac address " . ($ClientVal->"mac-address") . \
- " did not connect to WPA, removing from access list.") false;
+ $LogPrint info $ScriptName ("Client with mac address " . ($ClientVal->"mac-address") . \
+ " did not connect to WPA, removing from access list.");
/interface/wifi/access-list/remove $Client;
}
}
@@ -64,8 +64,8 @@
:foreach Lease in=[ /ip/dhcp-server/lease/find where !dynamic status="waiting" \
server=$Server last-seen>$Timeout comment~"^hotspot-to-wpa:" ] do={
:local LeaseVal [ /ip/dhcp-server/lease/get $Lease ];
- $LogPrintExit2 info $ScriptName ("Client with mac address " . ($LeaseVal->"mac-address") . \
- " was not seen for " . ($LeaseVal->"last-seen") . ", removing.") false;
+ $LogPrint info $ScriptName ("Client with mac address " . ($LeaseVal->"mac-address") . \
+ " was not seen for " . ($LeaseVal->"last-seen") . ", removing.");
/interface/wifi/access-list/remove [ find where comment~"^hotspot-to-wpa:" \
mac-address=($LeaseVal->"mac-address") ];
/ip/dhcp-server/lease/remove $Lease;
diff --git a/hotspot-to-wpa.capsman.rsc b/hotspot-to-wpa.capsman.rsc
index a6ad2a1..37c8464 100644
--- a/hotspot-to-wpa.capsman.rsc
+++ b/hotspot-to-wpa.capsman.rsc
@@ -17,7 +17,7 @@
:local ScriptName [ :jobname ];
:global EitherOr;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -29,7 +29,8 @@
}
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
- $LogPrintExit2 error $ScriptName ("This script is supposed to run from hotspot on login.") true;
+ $LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
+ :error false;
}
:local Date [ /system/clock/get date ];
@@ -42,28 +43,28 @@
:if ([ :len [ /caps-man/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ] ] = 0) do={
/caps-man/access-list/add comment="--- hotspot-to-wpa above ---" disabled=yes;
- $LogPrintExit2 warning $ScriptName ("Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'.") false;
+ $LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'.");
}
:local PlaceBefore ([ /caps-man/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ]->0);
:if ([ :len [ /caps-man/access-list/find where \
comment=("hotspot-to-wpa template " . $Hotspot) disabled ] ] = 0) do={
/caps-man/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore;
- $LogPrintExit2 warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'.") false;
+ $LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'.");
}
:local Template [ /caps-man/access-list/get ([ find where \
comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ];
:if ($Template->"action" = "reject") do={
- $LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") false;
+ $LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
:error true;
}
# allow login page to load
:delay 1s;
- $LogPrintExit2 info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
- " (user " . $UserName . ").") false;
+ $LogPrint info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
+ " (user " . $UserName . ").");
/caps-man/access-list/remove [ find where mac-address=$MacAddress comment~"^hotspot-to-wpa: " ];
/caps-man/access-list/add private-passphrase=($UserVal->"password") ssid-regexp="-wpa\$" \
mac-address=$MacAddress comment=("hotspot-to-wpa: " . $UserName . ", " . $MacAddress . ", " . $Date) \
diff --git a/hotspot-to-wpa.template.rsc b/hotspot-to-wpa.template.rsc
index b7869c4..cbce42a 100644
--- a/hotspot-to-wpa.template.rsc
+++ b/hotspot-to-wpa.template.rsc
@@ -18,7 +18,7 @@
:local ScriptName [ :jobname ];
:global EitherOr;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -30,7 +30,8 @@
}
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
- $LogPrintExit2 error $ScriptName ("This script is supposed to run from hotspot on login.") true;
+ $LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
+ :error false;
}
:local Date [ /system/clock/get date ];
@@ -45,7 +46,7 @@
:if ([ :len [ /interface/wifi/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ] ] = 0) do={
/caps-man/access-list/add comment="--- hotspot-to-wpa above ---" disabled=yes;
/interface/wifi/access-list/add comment="--- hotspot-to-wpa above ---" disabled=yes;
- $LogPrintExit2 warning $ScriptName ("Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'.") false;
+ $LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'.");
}
:local PlaceBefore ([ /caps-man/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ]->0);
:local PlaceBefore ([ /interface/wifi/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ]->0);
@@ -55,22 +56,22 @@
comment=("hotspot-to-wpa template " . $Hotspot) disabled ] ] = 0) do={
/caps-man/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore;
/interface/wifi/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore;
- $LogPrintExit2 warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'.") false;
+ $LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'.");
}
:local Template [ /caps-man/access-list/get ([ find where \
:local Template [ /interface/wifi/access-list/get ([ find where \
comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ];
:if ($Template->"action" = "reject") do={
- $LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") false;
+ $LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
:error true;
}
# allow login page to load
:delay 1s;
- $LogPrintExit2 info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
- " (user " . $UserName . ").") false;
+ $LogPrint info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
+ " (user " . $UserName . ").");
/caps-man/access-list/remove [ find where mac-address=$MacAddress comment~"^hotspot-to-wpa: " ];
/interface/wifi/access-list/remove [ find where mac-address=$MacAddress comment~"^hotspot-to-wpa: " ];
/caps-man/access-list/add private-passphrase=($UserVal->"password") ssid-regexp="-wpa\$" \
diff --git a/hotspot-to-wpa.wifi.rsc b/hotspot-to-wpa.wifi.rsc
index e728d7f..86aeed7 100644
--- a/hotspot-to-wpa.wifi.rsc
+++ b/hotspot-to-wpa.wifi.rsc
@@ -17,7 +17,7 @@
:local ScriptName [ :jobname ];
:global EitherOr;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -29,7 +29,8 @@
}
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
- $LogPrintExit2 error $ScriptName ("This script is supposed to run from hotspot on login.") true;
+ $LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
+ :error false;
}
:local Date [ /system/clock/get date ];
@@ -42,28 +43,28 @@
:if ([ :len [ /interface/wifi/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ] ] = 0) do={
/interface/wifi/access-list/add comment="--- hotspot-to-wpa above ---" disabled=yes;
- $LogPrintExit2 warning $ScriptName ("Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'.") false;
+ $LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'.");
}
:local PlaceBefore ([ /interface/wifi/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ]->0);
:if ([ :len [ /interface/wifi/access-list/find where \
comment=("hotspot-to-wpa template " . $Hotspot) disabled ] ] = 0) do={
/interface/wifi/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore;
- $LogPrintExit2 warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'.") false;
+ $LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'.");
}
:local Template [ /interface/wifi/access-list/get ([ find where \
comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ];
:if ($Template->"action" = "reject") do={
- $LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") false;
+ $LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
:error true;
}
# allow login page to load
:delay 1s;
- $LogPrintExit2 info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
- " (user " . $UserName . ").") false;
+ $LogPrint info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
+ " (user " . $UserName . ").");
/interface/wifi/access-list/remove [ find where mac-address=$MacAddress comment~"^hotspot-to-wpa: " ];
/interface/wifi/access-list/add passphrase=($UserVal->"password") ssid-regexp="-wpa\$" \
mac-address=$MacAddress comment=("hotspot-to-wpa: " . $UserName . ", " . $MacAddress . ", " . $Date) \
diff --git a/ipsec-to-dns.rsc b/ipsec-to-dns.rsc
index 03abf59..dd40ca2 100644
--- a/ipsec-to-dns.rsc
+++ b/ipsec-to-dns.rsc
@@ -22,7 +22,7 @@
:global CharacterReplace;
:global EscapeForRegEx;
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
@@ -38,7 +38,7 @@
:if ([ :len [ /ip/dns/static/find where (name=$CommentString or (comment=$CommentString and name=-)) type=NXDOMAIN disabled ] ] = 0) do={
/ip/dns/static/add name=$CommentString type=NXDOMAIN disabled=yes;
- $LogPrintExit2 warning $ScriptName ("Added disabled static dns record with name '" . $CommentString . "'.") false;
+ $LogPrint warning $ScriptName ("Added disabled static dns record with name '" . $CommentString . "'.");
}
:local PlaceBefore ([ /ip/dns/static/find where (name=$CommentString or (comment=$CommentString and name=-)) type=NXDOMAIN disabled ]->0);
@@ -47,10 +47,10 @@
:local PeerId [ $CharacterReplace ($DnsRecordVal->"comment") $CommentPrefix "" ];
:if ([ :len [ /ip/ipsec/active-peers/find where id~("^(CN=)?" . [ $EscapeForRegEx $PeerId ] . "\$") \
dynamic-address=($DnsRecordVal->"address") ] ] > 0) do={
- $LogPrintExit2 debug $ScriptName ("Peer " . $PeerId . " (" . $DnsRecordVal->"name" . ") still exists. Not deleting DNS entry.") false;
+ $LogPrint debug $ScriptName ("Peer " . $PeerId . " (" . $DnsRecordVal->"name" . ") still exists. Not deleting DNS entry.");
} else={
:local Found false;
- $LogPrintExit2 info $ScriptName ("Peer " . $PeerId . " (" . $DnsRecordVal->"name" . ") has gone, deleting DNS entry.") false;
+ $LogPrint info $ScriptName ("Peer " . $PeerId . " (" . $DnsRecordVal->"name" . ") has gone, deleting DNS entry.");
/ip/dns/static/remove $DnsRecord;
}
}
@@ -66,13 +66,13 @@
:if ([ :len $DnsRecord ] > 0) do={
:local DnsIp [ /ip/dns/static/get $DnsRecord address ];
:if ($DnsIp = $PeerVal->"dynamic-address") do={
- $LogPrintExit2 debug $ScriptName ("DNS entry for " . $Fqdn . " does not need updating.") false;
+ $LogPrint debug $ScriptName ("DNS entry for " . $Fqdn . " does not need updating.");
} else={
- $LogPrintExit2 info $ScriptName ("Replacing DNS entry for " . $Fqdn . ", new address is " . $PeerVal->"dynamic-address" . ".") false;
+ $LogPrint info $ScriptName ("Replacing DNS entry for " . $Fqdn . ", new address is " . $PeerVal->"dynamic-address" . ".");
/ip/dns/static/set name=$Fqdn address=($PeerVal->"dynamic-address") ttl=$Ttl comment=$Comment $DnsRecord;
}
} else={
- $LogPrintExit2 info $ScriptName ("Adding new DNS entry for " . $Fqdn . ", address is " . $PeerVal->"dynamic-address" . ".") false;
+ $LogPrint info $ScriptName ("Adding new DNS entry for " . $Fqdn . ", address is " . $PeerVal->"dynamic-address" . ".");
/ip/dns/static/add name=$Fqdn address=($PeerVal->"dynamic-address") ttl=$Ttl comment=$Comment place-before=$PlaceBefore;
}
}
diff --git a/ipv6-update.rsc b/ipv6-update.rsc
index 8ce1e4d..65bb959 100644
--- a/ipv6-update.rsc
+++ b/ipv6-update.rsc
@@ -14,7 +14,7 @@
:do {
:local ScriptName [ :jobname ];
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -25,19 +25,20 @@
}
:if ([ :typeof $PdPrefix ] = "nothing") do={
- $LogPrintExit2 error $ScriptName ("This script is supposed to run from ipv6 dhcp-client.") true;
+ $LogPrint error $ScriptName ("This script is supposed to run from ipv6 dhcp-client.");
+ :error false;
}
:local Pool [ /ipv6/pool/get [ find where prefix=$PdPrefix ] name ];
:if ([ :len [ /ipv6/firewall/address-list/find where comment=("ipv6-pool-" . $Pool) ] ] = 0) do={
/ipv6/firewall/address-list/add list=("ipv6-pool-" . $Pool) address=:: comment=("ipv6-pool-" . $Pool);
- $LogPrintExit2 warning $ScriptName ("Added ipv6 address list entry for ipv6-pool-" . $Pool) false;
+ $LogPrint warning $ScriptName ("Added ipv6 address list entry for ipv6-pool-" . $Pool);
}
:local AddrList [ /ipv6/firewall/address-list/find where comment=("ipv6-pool-" . $Pool) ];
:local OldPrefix [ /ipv6/firewall/address-list/get ($AddrList->0) address ];
:if ($OldPrefix != $PdPrefix) do={
- $LogPrintExit2 info $ScriptName ("Updating IPv6 address list with new IPv6 prefix " . $PdPrefix) false;
+ $LogPrint info $ScriptName ("Updating IPv6 address list with new IPv6 prefix " . $PdPrefix);
/ipv6/firewall/address-list/set address=$PdPrefix $AddrList;
# give the interfaces a moment to receive their addresses
@@ -56,12 +57,12 @@
:local Address ($ListEntryVal->"address");
:local Address ($Prefix | ([ :toip6 [ :pick $Address 0 [ :find $Address "/128" ] ] ] & ::ffff:ffff:ffff:ffff));
- $LogPrintExit2 info $ScriptName ("Updating IPv6 address list with new IPv6 host address " . $Address . \
- " from interface " . ($Comment->"interface")) false;
+ $LogPrint info $ScriptName ("Updating IPv6 address list with new IPv6 host address " . $Address . \
+ " from interface " . ($Comment->"interface"));
/ipv6/firewall/address-list/set address=$Address $ListEntry;
} else={
- $LogPrintExit2 info $ScriptName ("Updating IPv6 address list with new IPv6 prefix " . $Prefix . \
- " from interface " . ($Comment->"interface")) false;
+ $LogPrint info $ScriptName ("Updating IPv6 address list with new IPv6 prefix " . $Prefix . \
+ " from interface " . ($Comment->"interface"));
/ipv6/firewall/address-list/set address=$Prefix $ListEntry;
}
}
@@ -77,8 +78,8 @@
:set Prefix ([ :toip6 [ :pick $Prefix 0 [ :find $Prefix "/64" ] ] ] & ffff:ffff:ffff:ffff::);
:local Address ($Prefix | ([ :toip6 ($RecordVal->"address") ] & ::ffff:ffff:ffff:ffff));
- $LogPrintExit2 info $ScriptName ("Updating DNS record for " . ($RecordVal->"name") . \
- ($RecordVal->"regexp") . " to " . $Address) false;
+ $LogPrint info $ScriptName ("Updating DNS record for " . ($RecordVal->"name") . \
+ ($RecordVal->"regexp") . " to " . $Address);
/ip/dns/static/set address=$Address $Record;
}
}
diff --git a/lease-script.rsc b/lease-script.rsc
index 0f6b7f8..8e1e8f6 100644
--- a/lease-script.rsc
+++ b/lease-script.rsc
@@ -16,7 +16,7 @@
:global Grep;
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -24,18 +24,19 @@
[ :typeof $leaseActMAC ] = "nothing" || \
[ :typeof $leaseServerName ] = "nothing" || \
[ :typeof $leaseBound ] = "nothing") do={
- $LogPrintExit2 error $ScriptName ("This script is supposed to run from ip dhcp-server.") true;
+ $LogPrint error $ScriptName ("This script is supposed to run from ip dhcp-server.");
+ :error false;
}
- $LogPrintExit2 debug $ScriptName ("DHCP Server " . $leaseServerName . " " . [ $IfThenElse ($leaseBound = 0) \
- "de" "" ] . "assigned lease " . $leaseActIP . " to " . $leaseActMAC) false;
+ $LogPrint debug $ScriptName ("DHCP Server " . $leaseServerName . " " . [ $IfThenElse ($leaseBound = 0) \
+ "de" "" ] . "assigned lease " . $leaseActIP . " to " . $leaseActMAC);
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:error false;
}
:if ([ :len [ /system/script/job/find where script=$ScriptName ] ] > 1) do={
- $LogPrintExit2 debug $ScriptName ("More invocations are waiting, exiting early.") false;
+ $LogPrint debug $ScriptName ("More invocations are waiting, exiting early.");
:error true;
}
@@ -49,10 +50,10 @@
:foreach Order,Script in=$RunOrder do={
:do {
- $LogPrintExit2 debug $ScriptName ("Running script with order " . $Order . ": " . $Script) false;
+ $LogPrint debug $ScriptName ("Running script with order " . $Order . ": " . $Script);
/system/script/run $Script;
} on-error={
- $LogPrintExit2 warning $ScriptName ("Running script '" . $Script . "' failed!") false;
+ $LogPrint warning $ScriptName ("Running script '" . $Script . "' failed!");
}
}
} on-error={ }
diff --git a/log-forward.rsc b/log-forward.rsc
index 09e3b84..a919d8f 100644
--- a/log-forward.rsc
+++ b/log-forward.rsc
@@ -26,7 +26,7 @@
:global HexToNum;
:global IfThenElse;
:global LogForwardFilterLogForwarding;
- :global LogPrintExit2;
+ :global LogPrint;
:global MAX;
:global ScriptLock;
:global SendNotification2;
@@ -42,7 +42,7 @@
:if ($LogForwardRateLimit > 30) do={
:set LogForwardRateLimit ($LogForwardRateLimit - 1);
- $LogPrintExit2 info $ScriptName ("Rate limit in action, not forwarding logs, if any!") false;
+ $LogPrint info $ScriptName ("Rate limit in action, not forwarding logs, if any!");
:error false;
}
diff --git a/mod/bridge-port-to.rsc b/mod/bridge-port-to.rsc
index a78f31b..441094f 100644
--- a/mod/bridge-port-to.rsc
+++ b/mod/bridge-port-to.rsc
@@ -12,7 +12,7 @@
:local BridgePortTo [ :tostr $1 ];
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:local InterfaceReEnable ({});
@@ -24,21 +24,22 @@
:if ($BridgeDefault = "dhcp-client") do={
:if ([ :len $DHCPClient ] != 1) do={
- $LogPrintExit2 warning $0 ([ $IfThenElse ([ :len $DHCPClient ] = 0) "Missing" "Duplicate" ] . \
- " dhcp client configuration for interface " . $BridgePortVal->"interface" . "!") true;
+ $LogPrint warning $0 ([ $IfThenElse ([ :len $DHCPClient ] = 0) "Missing" "Duplicate" ] . \
+ " dhcp client configuration for interface " . $BridgePortVal->"interface" . "!");
+ :error false;
}
:local DHCPClientDisabled [ /ip/dhcp-client/get $DHCPClient disabled ];
:if ($BridgePortVal->"disabled" = false || $DHCPClientDisabled = true) do={
- $LogPrintExit2 info $0 ("Disabling bridge port for interface " . $BridgePortVal->"interface" . ", enabling dhcp client.") false;
+ $LogPrint info $0 ("Disabling bridge port for interface " . $BridgePortVal->"interface" . ", enabling dhcp client.");
/interface/bridge/port/disable $BridgePort;
:delay 200ms;
/ip/dhcp-client/enable $DHCPClient;
}
} else={
:if ($BridgePortVal->"disabled" = true || $BridgeDefault != $BridgePortVal->"bridge") do={
- $LogPrintExit2 info $0 ("Enabling bridge port for interface " . $BridgePortVal->"interface" . ", changing to " . $BridgePortTo . \
- " bridge " . $BridgeDefault . ", disabling dhcp client.") false;
+ $LogPrint info $0 ("Enabling bridge port for interface " . $BridgePortVal->"interface" . ", changing to " . $BridgePortTo . \
+ " bridge " . $BridgeDefault . ", disabling dhcp client.");
:if ([ :len $DHCPClient ] = 1) do={
/ip/dhcp-client/disable $DHCPClient;
:delay 200ms;
@@ -50,8 +51,8 @@
}
/interface/bridge/port/set disabled=no bridge=$BridgeDefault $BridgePort;
} else={
- $LogPrintExit2 debug $0 ("Interface " . $BridgePortVal->"interface" . " already connected to " . $BridgePortTo . \
- " bridge " . $BridgeDefault . ".") false;
+ $LogPrint debug $0 ("Interface " . $BridgePortVal->"interface" . " already connected to " . $BridgePortTo . \
+ " bridge " . $BridgeDefault . ".");
}
}
}
@@ -59,7 +60,7 @@
}
:if ([ :len $InterfaceReEnable ] > 0) do={
:delay 5s;
- $LogPrintExit2 info $0 ("Re-enabling interfaces...") false;
+ $LogPrint info $0 ("Re-enabling interfaces...");
/interface/ethernet/enable $InterfaceReEnable;
}
}
diff --git a/mod/bridge-port-vlan.rsc b/mod/bridge-port-vlan.rsc
index 72cf772..522e9a6 100644
--- a/mod/bridge-port-vlan.rsc
+++ b/mod/bridge-port-vlan.rsc
@@ -12,7 +12,7 @@
:local ConfigTo [ :tostr $1 ];
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:local InterfaceReEnable ({});
@@ -24,13 +24,14 @@
:if ($Vlan = "dhcp-client") do={
:if ([ :len $DHCPClient ] != 1) do={
- $LogPrintExit2 warning $0 ([ $IfThenElse ([ :len $DHCPClient ] = 0) "Missing" "Duplicate" ] . \
- " dhcp client configuration for interface " . $BridgePortVal->"interface" . "!") true;
+ $LogPrint warning $0 ([ $IfThenElse ([ :len $DHCPClient ] = 0) "Missing" "Duplicate" ] . \
+ " dhcp client configuration for interface " . $BridgePortVal->"interface" . "!");
+ :error false;
}
:local DHCPClientDisabled [ /ip/dhcp-client/get $DHCPClient disabled ];
:if ($BridgePortVal->"disabled" = false || $DHCPClientDisabled = true) do={
- $LogPrintExit2 info $0 ("Disabling bridge port for interface " . $BridgePortVal->"interface" . ", enabling dhcp client.") false;
+ $LogPrint info $0 ("Disabling bridge port for interface " . $BridgePortVal->"interface" . ", enabling dhcp client.");
/interface/bridge/port/disable $BridgePort;
:delay 200ms;
/ip/dhcp-client/enable $DHCPClient;
@@ -41,12 +42,13 @@
:do {
:set $Vlan ([ /interface/bridge/vlan/get [ find where comment=$Vlan ] vlan-ids ]->0);
} on-error={
- $LogPrintExit2 warning $0 ("Could not find VLAN '" . $Vlan . "' for interface " . $BridgePortVal->"interface" . "!") true;
+ $LogPrint warning $0 ("Could not find VLAN '" . $Vlan . "' for interface " . $BridgePortVal->"interface" . "!");
+ :error false;
}
}
:if ($BridgePortVal->"disabled" = true || $Vlan != $BridgePortVal->"pvid") do={
- $LogPrintExit2 info $0 ("Enabling bridge port for interface " . $BridgePortVal->"interface" . ", changing to " . $ConfigTo . \
- " vlan " . $Vlan . [ $IfThenElse ($Vlan != $VlanName) (" (" . $VlanName . ")") ] . ", disabling dhcp client.") false;
+ $LogPrint info $0 ("Enabling bridge port for interface " . $BridgePortVal->"interface" . ", changing to " . $ConfigTo . \
+ " vlan " . $Vlan . [ $IfThenElse ($Vlan != $VlanName) (" (" . $VlanName . ")") ] . ", disabling dhcp client.");
:if ([ :len $DHCPClient ] = 1) do={
/ip/dhcp-client/disable $DHCPClient;
:delay 200ms;
@@ -58,8 +60,8 @@
}
/interface/bridge/port/set disabled=no pvid=$Vlan $BridgePort;
} else={
- $LogPrintExit2 debug $0 ("Interface " . $BridgePortVal->"interface" . " already connected to " . $ConfigTo . \
- " vlan " . $Vlan . ".") false;
+ $LogPrint debug $0 ("Interface " . $BridgePortVal->"interface" . " already connected to " . $ConfigTo . \
+ " vlan " . $Vlan . ".");
}
}
}
@@ -67,7 +69,7 @@
}
:if ([ :len $InterfaceReEnable ] > 0) do={
:delay 5s;
- $LogPrintExit2 info $0 ("Re-enabling interfaces...") false;
+ $LogPrint info $0 ("Re-enabling interfaces...");
/interface/ethernet/enable $InterfaceReEnable;
}
}
diff --git a/mod/notification-email.rsc b/mod/notification-email.rsc
index 88bfdac..78192f3 100644
--- a/mod/notification-email.rsc
+++ b/mod/notification-email.rsc
@@ -24,7 +24,7 @@
:global EitherOr;
:global IsDNSResolving;
:global IsTimeSync;
- :global LogPrintExit2;
+ :global LogPrint;
:local AllDone true;
:local QueueLen [ :len $EmailQueue ];
@@ -35,23 +35,23 @@
}
:if ([ /tool/e-mail/get last-status ] = "in-progress") do={
- $LogPrintExit2 debug $0 ("Sending mail is currently in progress, not flushing.") false;
+ $LogPrint debug $0 ("Sending mail is currently in progress, not flushing.");
:return false;
}
:if ([ $IsTimeSync ] = false) do={
- $LogPrintExit2 debug $0 ("Time is not synced, not flushing.") false;
+ $LogPrint debug $0 ("Time is not synced, not flushing.");
:return false;
}
:local EMailSettings [ /tool/e-mail/get ];
:if ([ :typeof [ :toip ($EMailSettings->"server") ] ] != "ip" && [ $IsDNSResolving ] = false) do={
- $LogPrintExit2 debug $0 ("Server address is a DNS name and resolving fails, not flushing.") false;
+ $LogPrint debug $0 ("Server address is a DNS name and resolving fails, not flushing.");
:return false;
}
:if ([ :len $Scheduler ] > 0 && $QueueLen = 0) do={
- $LogPrintExit2 warning $0 ("Flushing E-Mail messages from scheduler, but queue is empty.") false;
+ $LogPrint warning $0 ("Flushing E-Mail messages from scheduler, but queue is empty.");
}
/system/scheduler/set interval=([ $EitherOr $QueueLen 1 ] . "m") comment="Sending..." $Scheduler;
@@ -64,7 +64,7 @@
:if ([ :len [ /file/find where name=$File ] ] = 1) do={
:set Attach ($Attach, $File);
} else={
- $LogPrintExit2 warning $0 ("File '" . $File . "' does not exist, can not attach.") false;
+ $LogPrint warning $0 ("File '" . $File . "' does not exist, can not attach.");
}
}
/tool/e-mail/send to=($Message->"to") cc=($Message->"cc") subject=($Message->"subject") \
diff --git a/mod/notification-matrix.rsc b/mod/notification-matrix.rsc
index 8884b08..c4fe100 100644
--- a/mod/notification-matrix.rsc
+++ b/mod/notification-matrix.rsc
@@ -20,10 +20,10 @@
:global MatrixQueue;
:global IsFullyConnected;
- :global LogPrintExit2;
+ :global LogPrint;
:if ([ $IsFullyConnected ] = false) do={
- $LogPrintExit2 debug $0 ("System is not fully connected, not flushing.") false;
+ $LogPrint debug $0 ("System is not fully connected, not flushing.");
:return false;
}
@@ -31,7 +31,7 @@
:local QueueLen [ :len $MatrixQueue ];
:if ([ :len [ /system/scheduler/find where name="_FlushMatrixQueue" ] ] > 0 && $QueueLen = 0) do={
- $LogPrintExit2 warning $0 ("Flushing Matrix messages from scheduler, but queue is empty.") false;
+ $LogPrint warning $0 ("Flushing Matrix messages from scheduler, but queue is empty.");
}
:foreach Id,Message in=$MatrixQueue do={
@@ -45,7 +45,7 @@
$Message->"formatted" . "\" }") as-value;
:set ($MatrixQueue->$Id);
} on-error={
- $LogPrintExit2 debug $0 ("Sending queued Matrix message failed.") false;
+ $LogPrint debug $0 ("Sending queued Matrix message failed.");
:set AllDone false;
}
}
@@ -72,7 +72,7 @@
:global MatrixRoomOverride;
:global EitherOr;
- :global LogPrintExit2;
+ :global LogPrint;
:global SymbolForNotification;
:local PrepareText do={
@@ -134,7 +134,7 @@
"\"format\": \"org.matrix.custom.html\", \"formatted_body\": \"" . \
$Formatted . "\" }") as-value;
} on-error={
- $LogPrintExit2 info $0 ("Failed sending Matrix notification! Queuing...") false;
+ $LogPrint info $0 ("Failed sending Matrix notification! Queuing...");
:if ([ :typeof $MatrixQueue ] = "nothing") do={
:set MatrixQueue ({});
@@ -184,7 +184,7 @@
:local Pass [ :tostr $2 ];
:global CharacterReplace;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseJson;
:global MatrixAccessToken;
@@ -195,9 +195,10 @@
:local Data ([ /tool/fetch check-certificate=yes-without-crl output=user \
("https://" . $Domain . "/.well-known/matrix/client") as-value ]->"data");
:set MatrixHomeServer ([ $ParseJson ([ $ParseJson [ $CharacterReplace $Data " " "" ] ]->"m.homeserver") ]->"base_url");
- $LogPrintExit2 debug $0 ("Home server is: " . $MatrixHomeServer) false;
+ $LogPrint debug $0 ("Home server is: " . $MatrixHomeServer);
} on-error={
- $LogPrintExit2 error $0 ("Failed getting home server!") true;
+ $LogPrint error $0 ("Failed getting home server!");
+ :error false;
}
:if ([ :pick $MatrixHomeServer 0 8 ] = "https://") do={
@@ -209,18 +210,20 @@
http-method=post http-data=("{\"type\":\"m.login.password\", \"user\":\"" . $User . "\", \"password\":\"" . $Pass . "\"}") \
("https://" . $MatrixHomeServer . "/_matrix/client/r0/login") as-value ]->"data");
:set MatrixAccessToken ([ $ParseJson $Data ]->"access_token");
- $LogPrintExit2 debug $0 ("Access token is: " . $MatrixAccessToken) false;
+ $LogPrint debug $0 ("Access token is: " . $MatrixAccessToken);
} on-error={
- $LogPrintExit2 error $0 ("Failed logging in (and getting access token)!") true;
+ $LogPrint error $0 ("Failed logging in (and getting access token)!");
+ :error false;
}
:do {
/system/script/set global-config-overlay source=([ get global-config-overlay source ] . "\n" . \
":global MatrixHomeServer \"" . $MatrixHomeServer . "\";\n" . \
":global MatrixAccessToken \"" . $MatrixAccessToken . "\";\n");
- $LogPrintExit2 info $0 ("Appended configuration to global-config-overlay. Now create and join a room, please!") false;
+ $LogPrint info $0 ("Appended configuration to global-config-overlay. Now create and join a room, please!");
} on-error={
- $LogPrintExit2 error $0 ("Failed appending configuration to global-config-overlay!") true;
+ $LogPrint error $0 ("Failed appending configuration to global-config-overlay!");
+ :error false;
}
}
@@ -228,7 +231,7 @@
:set SetupMatrixJoinRoom do={
:global MatrixRoom [ :tostr $1 ];
- :global LogPrintExit2;
+ :global LogPrint;
:global UrlEncode;
:global MatrixAccessToken;
@@ -240,16 +243,18 @@
http-method=post http-data="" \
("https://" . $MatrixHomeServer . "/_matrix/client/r0/rooms/" . [ $UrlEncode $MatrixRoom ] . \
"/join?access_token=" . [ $UrlEncode $MatrixAccessToken ]) as-value;
- $LogPrintExit2 debug $0 ("Joined the room.") false;
+ $LogPrint debug $0 ("Joined the room.");
} on-error={
- $LogPrintExit2 error $0 ("Failed joining the room!") true;
+ $LogPrint error $0 ("Failed joining the room!");
+ :error false;
}
:do {
/system/script/set global-config-overlay source=([ get global-config-overlay source ] . "\n" . \
":global MatrixRoom \"" . $MatrixRoom . "\";\n");
- $LogPrintExit2 info $0 ("Appended configuration to global-config-overlay. Please review and cleanup!") false;
+ $LogPrint info $0 ("Appended configuration to global-config-overlay. Please review and cleanup!");
} on-error={
- $LogPrintExit2 error $0 ("Failed appending configuration to global-config-overlay!") true;
+ $LogPrint error $0 ("Failed appending configuration to global-config-overlay!");
+ :error false;
}
}
diff --git a/mod/notification-ntfy.rsc b/mod/notification-ntfy.rsc
index 4dc6d84..6d48a59 100644
--- a/mod/notification-ntfy.rsc
+++ b/mod/notification-ntfy.rsc
@@ -18,10 +18,10 @@
:global NtfyMessageIDs;
:global IsFullyConnected;
- :global LogPrintExit2;
+ :global LogPrint;
:if ([ $IsFullyConnected ] = false) do={
- $LogPrintExit2 debug $0 ("System is not fully connected, not flushing.") false;
+ $LogPrint debug $0 ("System is not fully connected, not flushing.");
:return false;
}
@@ -29,7 +29,7 @@
:local QueueLen [ :len $NtfyQueue ];
:if ([ :len [ /system/scheduler/find where name="_FlushNtfyQueue" ] ] > 0 && $QueueLen = 0) do={
- $LogPrintExit2 warning $0 ("Flushing Ntfy messages from scheduler, but queue is empty.") false;
+ $LogPrint warning $0 ("Flushing Ntfy messages from scheduler, but queue is empty.");
}
:foreach Id,Message in=$NtfyQueue do={
@@ -39,7 +39,7 @@
($Message->"url") http-header-field=($Message->"headers") http-data=($Message->"text") as-value;
:set ($NtfyQueue->$Id);
} on-error={
- $LogPrintExit2 debug $0 ("Sending queued Ntfy message failed.") false;
+ $LogPrint debug $0 ("Sending queued Ntfy message failed.");
:set AllDone false;
}
}
@@ -66,7 +66,7 @@
:global CertificateAvailable;
:global EitherOr;
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global SymbolForNotification;
:global UrlEncode;
@@ -88,13 +88,14 @@
:do {
:if ($NtfyServer = "ntfy.sh") do={
:if ([ $CertificateAvailable "R3" ] = false) do={
- $LogPrintExit2 warning $0 ("Downloading required certificate failed.") true;
+ $LogPrint warning $0 ("Downloading required certificate failed.");
+ :error false;
}
}
/tool/fetch check-certificate=yes-without-crl output=none http-method=post \
$Url http-header-field=$Headers http-data=$Text as-value;
} on-error={
- $LogPrintExit2 info $0 ("Failed sending ntfy notification! Queuing...") false;
+ $LogPrint info $0 ("Failed sending ntfy notification! Queuing...");
:if ([ :typeof $NtfyQueue ] = "nothing") do={
:set NtfyQueue ({});
diff --git a/mod/notification-telegram.rsc b/mod/notification-telegram.rsc
index 5b79135..506ec80 100644
--- a/mod/notification-telegram.rsc
+++ b/mod/notification-telegram.rsc
@@ -18,12 +18,12 @@
:global TelegramMessageIDs;
:global IsFullyConnected;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseJson;
:global UrlEncode;
:if ([ $IsFullyConnected ] = false) do={
- $LogPrintExit2 debug $0 ("System is not fully connected, not flushing.") false;
+ $LogPrint debug $0 ("System is not fully connected, not flushing.");
:return false;
}
@@ -31,7 +31,7 @@
:local QueueLen [ :len $TelegramQueue ];
:if ([ :len [ /system/scheduler/find where name="_FlushTelegramQueue" ] ] > 0 && $QueueLen = 0) do={
- $LogPrintExit2 warning $0 ("Flushing Telegram messages from scheduler, but queue is empty.") false;
+ $LogPrint warning $0 ("Flushing Telegram messages from scheduler, but queue is empty.");
}
:foreach Id,Message in=$TelegramQueue do={
@@ -45,7 +45,7 @@
:set ($TelegramQueue->$Id);
:set ($TelegramMessageIDs->([ $ParseJson ([ $ParseJson $Data ]->"result") ]->"message_id")) 1;
} on-error={
- $LogPrintExit2 debug $0 ("Sending queued Telegram message failed.") false;
+ $LogPrint debug $0 ("Sending queued Telegram message failed.");
:set AllDone false;
}
}
@@ -74,7 +74,7 @@
:global CharacterReplace;
:global EitherOr;
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseJson;
:global SymbolForNotification;
:global UrlEncode;
@@ -136,7 +136,8 @@
:do {
:if ([ $CertificateAvailable "Go Daddy Secure Certificate Authority - G2" ] = false) do={
- $LogPrintExit2 warning $0 ("Downloading required certificate failed.") true;
+ $LogPrint warning $0 ("Downloading required certificate failed.");
+ :error false;
}
:local Data ([ /tool/fetch check-certificate=yes-without-crl output=user http-method=post \
("https://api.telegram.org/bot" . $TokenId . "/sendMessage") \
@@ -145,7 +146,7 @@
"&parse_mode=MarkdownV2&text=" . [ $UrlEncode $Text ]) as-value ]->"data");
:set ($TelegramMessageIDs->([ $ParseJson ([ $ParseJson $Data ]->"result") ]->"message_id")) 1;
} on-error={
- $LogPrintExit2 info $0 ("Failed sending telegram notification! Queuing...") false;
+ $LogPrint info $0 ("Failed sending telegram notification! Queuing...");
:if ([ :typeof $TelegramQueue ] = "nothing") do={
:set TelegramQueue ({});
diff --git a/mod/scriptrunonce.rsc b/mod/scriptrunonce.rsc
index 38348a0..ffb1aff 100644
--- a/mod/scriptrunonce.rsc
+++ b/mod/scriptrunonce.rsc
@@ -15,13 +15,14 @@
:global ScriptRunOnceBaseUrl;
:global ScriptRunOnceUrlSuffix;
- :global LogPrintExit2;
+ :global LogPrint;
:global ValidateSyntax;
:foreach Script in=$Scripts do={
:if (!($Script ~ "^(ftp|https?|sftp)://")) do={
:if ([ :len $ScriptRunOnceBaseUrl ] = 0) do={
- $LogPrintExit2 warning $0 ("Script '" . $Script . "' is not an url and base url is not available.") true;
+ $LogPrint warning $0 ("Script '" . $Script . "' is not an url and base url is not available.");
+ :error false;
}
:set Script ($ScriptRunOnceBaseUrl . $Script . ".rsc" . $ScriptRunOnceUrlSuffix);
}
@@ -30,19 +31,19 @@
:do {
:set Source ([ /tool/fetch check-certificate=yes-without-crl $Script output=user as-value ]->"data");
} on-error={
- $LogPrintExit2 warning $0 ("Failed fetching script '" . $Script . "'!") false;
+ $LogPrint warning $0 ("Failed fetching script '" . $Script . "'!");
}
:if ([ :len $Source ] > 0) do={
:if ([ $ValidateSyntax $Source ] = true) do={
:do {
- $LogPrintExit2 info $0 ("Running script '" . $Script . "' now.") false;
+ $LogPrint info $0 ("Running script '" . $Script . "' now.");
[ :parse $Source ];
} on-error={
- $LogPrintExit2 warning $0 ("The script '" . $Script . "' failed to run!") false;
+ $LogPrint warning $0 ("The script '" . $Script . "' failed to run!");
}
} else={
- $LogPrintExit2 warning $0 ("The script '" . $Script . "' failed syntax validation!") false;
+ $LogPrint warning $0 ("The script '" . $Script . "' failed syntax validation!");
}
}
}
diff --git a/mod/ssh-keys-import.rsc b/mod/ssh-keys-import.rsc
index b88ef9a..fbc667e 100644
--- a/mod/ssh-keys-import.rsc
+++ b/mod/ssh-keys-import.rsc
@@ -18,32 +18,36 @@
:global CharacterReplace;
:global GetRandom20CharAlNum;
- :global LogPrintExit2;
+ :global LogPrint;
:global MkDir;
:global WaitForFile;
:if ([ :len $Key ] = 0 || [ :len $User ] = 0) do={
- $LogPrintExit2 warning $0 ("Missing argument(s), please pass key and user!") true;
+ $LogPrint warning $0 ("Missing argument(s), please pass key and user!");
+ :error false;
}
:if ([ :len [ /user/find where name=$User ] ] = 0) do={
- $LogPrintExit2 warning $0 ("User '" . $User . "' does not exist.") true;
+ $LogPrint warning $0 ("User '" . $User . "' does not exist.");
+ :error false;
}
:local KeyVal [ :toarray [ $CharacterReplace $Key " " "," ] ];
:if (!($KeyVal->0 = "ssh-ed25519" || $KeyVal->0 = "ssh-rsa")) do={
- $LogPrintExit2 warning $0 ("SSH key of type '" . $KeyVal->0 . "' is not supported.") true;
+ $LogPrint warning $0 ("SSH key of type '" . $KeyVal->0 . "' is not supported.");
+ :error false;
}
:if ([ $MkDir "tmpfs/ssh-keys-import" ] = false) do={
- $LogPrintExit2 warning $0 ("Creating directory 'tmpfs/ssh-keys-import' failed!") true;
+ $LogPrint warning $0 ("Creating directory 'tmpfs/ssh-keys-import' failed!");
+ :error false;
}
:local FingerPrintMD5 [ :convert from=base64 transform=md5 to=hex ($KeyVal->1) ];
:if ([ :len [ /user/ssh-keys/find where user=$User key-owner~("\\bmd5=" . $FingerPrintMD5 . "\\b") ] ] > 0) do={
- $LogPrintExit2 warning $0 ("The ssh public key (MD5:" . $FingerPrintMD5 . \
- ") is already available for user '" . $User . "'.") false;
+ $LogPrint warning $0 ("The ssh public key (MD5:" . $FingerPrintMD5 . \
+ ") is already available for user '" . $User . "'.");
:return false;
}
@@ -53,10 +57,11 @@
:do {
/user/ssh-keys/import public-key-file=$FileName user=$User;
- $LogPrintExit2 info $0 ("Imported ssh public key (" . $KeyVal->2 . ", " . $KeyVal->0 . ", " . \
- "MD5:" . $FingerPrintMD5 . ") for user '" . $User . "'.") false;
+ $LogPrint info $0 ("Imported ssh public key (" . $KeyVal->2 . ", " . $KeyVal->0 . ", " . \
+ "MD5:" . $FingerPrintMD5 . ") for user '" . $User . "'.");
} on-error={
- $LogPrintExit2 warning $0 ("Failed importing key.") true;
+ $LogPrint warning $0 ("Failed importing key.");
+ :error false;
}
}
@@ -67,17 +72,19 @@
:global CharacterReplace;
:global EitherOr;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global SSHKeysImport;
:if ([ :len $FileName ] = 0 || [ :len $User ] = 0) do={
- $LogPrintExit2 warning $0 ("Missing argument(s), please pass file name and user!") true;
+ $LogPrint warning $0 ("Missing argument(s), please pass file name and user!");
+ :error false;
}
:local File [ /file/find where name=$FileName ];
:if ([ :len $File ] = 0) do={
- $LogPrintExit2 warning $0 ("File '" . $FileName . "' does not exist.") true;
+ $LogPrint warning $0 ("File '" . $FileName . "' does not exist.");
+ :error false;
}
:local Keys ([ /file/get $FileName contents ] . "\n");
@@ -90,7 +97,7 @@
:do {
$SSHKeysImport $Line $User;
} on-error={
- $LogPrintExit2 warning $0 ("Failed importing key for user '" . $User . "'.") false;
+ $LogPrint warning $0 ("Failed importing key for user '" . $User . "'.");
}
:set Continue true;
}
@@ -99,7 +106,7 @@
:set Continue true;
}
:if ($Continue = false && [ :len ($KeyVal->0) ] > 0) do={
- $LogPrintExit2 warning $0 ("SSH key of type '" . $KeyVal->0 . "' is not supported.") false;
+ $LogPrint warning $0 ("SSH key of type '" . $KeyVal->0 . "' is not supported.");
}
} while=([ :len $Keys ] > 0);
}
diff --git a/mode-button.rsc b/mode-button.rsc
index 07788cb..f453f11 100644
--- a/mode-button.rsc
+++ b/mode-button.rsc
@@ -16,18 +16,18 @@
:global ModeButton;
- :global LogPrintExit2;
+ :global LogPrint;
:set ($ModeButton->"count") ($ModeButton->"count" + 1);
:local Scheduler [ /system/scheduler/find where name="_ModeButtonScheduler" ];
:if ([ :len $Scheduler ] = 0) do={
- $LogPrintExit2 info $ScriptName ("Creating scheduler _ModeButtonScheduler, counting presses...") false;
+ $LogPrint info $ScriptName ("Creating scheduler _ModeButtonScheduler, counting presses...");
:global ModeButtonScheduler do={
:global ModeButton;
- :global LogPrintExit2;
+ :global LogPrint;
:global ModeButtonScheduler;
:global ValidateSyntax;
@@ -52,7 +52,7 @@
:if ([ :len $Code ] > 0) do={
:if ([ $ValidateSyntax $Code ] = true) do={
- $LogPrintExit2 info $ScriptName ("Acting on " . $Count . " mode-button presses: " . $Code) false;
+ $LogPrint info $ScriptName ("Acting on " . $Count . " mode-button presses: " . $Code);
:for I from=1 to=$Count do={
$LEDInvert;
@@ -66,16 +66,16 @@
[ :parse $Code ];
} else={
- $LogPrintExit2 warning $ScriptName ("The code for " . $Count . " mode-button presses failed syntax validation!") false;
+ $LogPrint warning $ScriptName ("The code for " . $Count . " mode-button presses failed syntax validation!");
}
} else={
- $LogPrintExit2 info $ScriptName ("No action defined for " . $Count . " mode-button presses.") false;
+ $LogPrint info $ScriptName ("No action defined for " . $Count . " mode-button presses.");
}
}
/system/scheduler/add name="_ModeButtonScheduler" \
on-event=":global ModeButtonScheduler; \$ModeButtonScheduler;" interval=3s;
} else={
- $LogPrintExit2 debug $ScriptName ("Updating scheduler _ModeButtonScheduler...") false;
+ $LogPrint debug $ScriptName ("Updating scheduler _ModeButtonScheduler...");
/system/scheduler/set $Scheduler start-time=[ /system/clock/get time ];
}
} on-error={ }
diff --git a/netwatch-dns.rsc b/netwatch-dns.rsc
index 76f2685..50c2b4c 100644
--- a/netwatch-dns.rsc
+++ b/netwatch-dns.rsc
@@ -16,7 +16,7 @@
:global CertificateAvailable;
:global EitherOr;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -26,7 +26,7 @@
:local SettleTime (5m30s - [ /system/resource/get uptime ]);
:if ($SettleTime > 0s) do={
- $LogPrintExit2 info $ScriptName ("System just booted, giving netwatch " . $SettleTime . " to settle.") false;
+ $LogPrint info $ScriptName ("System just booted, giving netwatch " . $SettleTime . " to settle.");
:error true;
}
@@ -50,15 +50,14 @@
:if ([ :len $DnsServers ] > 0) do={
:if ($DnsServers != $DnsCurrent) do={
- $LogPrintExit2 info $ScriptName ("Updating DNS servers: " . [ :tostr $DnsServers ]) false;
+ $LogPrint info $ScriptName ("Updating DNS servers: " . [ :tostr $DnsServers ]);
/ip/dns/set servers=$DnsServers;
/ip/dns/cache/flush;
}
} else={
:if ([ :len $DnsFallback ] > 0) do={
:if ($DnsFallback != $DnsCurrent) do={
- $LogPrintExit2 info $ScriptName ("Updating DNS servers to fallback: " . \
- [ :tostr $DnsFallback ]) false;
+ $LogPrint info $ScriptName ("Updating DNS servers to fallback: " . [ :tostr $DnsFallback ]);
/ip/dns/set servers=$DnsFallback;
/ip/dns/cache/flush;
}
@@ -83,7 +82,7 @@
}
:if ($DohCurrent = $HostInfo->"doh-url") do={
- $LogPrintExit2 debug $ScriptName ("Current DoH server is still up: " . $DohCurrent) false;
+ $LogPrint debug $ScriptName ("Current DoH server is still up: " . $DohCurrent);
:error true;
}
@@ -92,7 +91,7 @@
}
:if ([ :len $DohCurrent ] > 0) do={
- $LogPrintExit2 info $ScriptName ("Current DoH server is down, disabling: " . $DohCurrent) false;
+ $LogPrint info $ScriptName ("Current DoH server is down, disabling: " . $DohCurrent);
/ip/dns/set use-doh-server="";
/ip/dns/cache/flush;
}
@@ -100,7 +99,7 @@
:foreach DohServer in=$DohServers do={
:if ([ :len ($DohServer->"doh-cert") ] > 0) do={
:if ([ $CertificateAvailable ($DohServer->"doh-cert") ] = false) do={
- $LogPrintExit2 warning $ScriptName ("Downloading certificate failed, trying without.") false;
+ $LogPrint warning $ScriptName ("Downloading certificate failed, trying without.");
}
}
@@ -112,19 +111,19 @@
"\01\00" . "\00\01" . "\00\00" . "\00\00" . "\00\00" . "\09doh-check\05eworm\02de\00" . \
"\00\10" . "\00\01") ]) as-value ]->"data");
} on-error={
- $LogPrintExit2 warning $ScriptName ("Request to DoH server failed (network or certificate issue): " . \
- ($DohServer->"doh-url")) false;
+ $LogPrint warning $ScriptName ("Request to DoH server failed (network or certificate issue): " . \
+ ($DohServer->"doh-url"));
}
:if ($Data != false) do={
:if ([ :typeof [ :find $Data "doh-check-OK" ] ] = "num") do={
/ip/dns/set use-doh-server=($DohServer->"doh-url") verify-doh-cert=yes;
/ip/dns/cache/flush;
- $LogPrintExit2 info $ScriptName ("Setting DoH server: " . ($DohServer->"doh-url")) false;
+ $LogPrint info $ScriptName ("Setting DoH server: " . ($DohServer->"doh-url"));
:error true;
} else={
- $LogPrintExit2 warning $ScriptName ("Received unexpected response from DoH server: " . \
- ($DohServer->"doh-url")) false;
+ $LogPrint warning $ScriptName ("Received unexpected response from DoH server: " . \
+ ($DohServer->"doh-url"));
}
}
}
diff --git a/netwatch-notify.rsc b/netwatch-notify.rsc
index 90d26f1..9536dd7 100644
--- a/netwatch-notify.rsc
+++ b/netwatch-notify.rsc
@@ -19,7 +19,7 @@
:global EitherOr;
:global IfThenElse;
:global IsDNSResolving;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptFromTerminal;
:global ScriptLock;
@@ -32,25 +32,22 @@
:local State [ :tostr $3 ];
:local Hook [ :tostr $4 ];
- :global LogPrintExit2;
+ :global LogPrint;
:global ValidateSyntax;
:if ([ $ValidateSyntax $Hook ] = true) do={
:do {
[ :parse $Hook ];
} on-error={
- $LogPrintExit2 warning $0 ("The " . $State . "-hook for " . $Type . " '" . $Name . \
- "' failed to run.") false;
+ $LogPrint warning $0 ("The " . $State . "-hook for " . $Type . " '" . $Name . "' failed to run.");
:return ("The hook failed to run.");
}
} else={
- $LogPrintExit2 warning $0 ("The " . $State . "-hook for " . $Type . " '" . $Name . \
- "' failed syntax validation.") false;
+ $LogPrint warning $0 ("The " . $State . "-hook for " . $Type . " '" . $Name . "' failed syntax validation.");
:return ("The hook failed syntax validation.");
}
- $LogPrintExit2 info $0 ("Ran hook on " . $Type . " '" . $Name . "' " . $State . ": " . \
- $Hook) false;
+ $LogPrint info $0 ("Ran hook on " . $Type . " '" . $Name . "' " . $State . ": " . $Hook);
:return ("Ran hook:\n" . $Hook);
}
@@ -106,10 +103,10 @@
:local Resolve [ :resolve ($HostInfo->"resolve") ];
:if ($Resolve != $HostVal->"host") do={
:if ([ $ResolveExpected ($HostInfo->"resolve") ($HostVal->"host") ] = false) do={
- $LogPrintExit2 info $ScriptName ("Name '" . $HostInfo->"resolve" . [ $IfThenElse \
+ $LogPrint info $ScriptName ("Name '" . $HostInfo->"resolve" . [ $IfThenElse \
($HostInfo->"resolve" != $HostInfo->"name") ("' for " . $Type . " '" . \
$HostInfo->"name") "" ] . "' resolves to different address " . $Resolve . \
- ", updating.") false;
+ ", updating.");
/tool/netwatch/set host=$Resolve $Host;
:set ($Metric->"resolve-failcnt") 0;
:set ($HostVal->"status") "unknown";
@@ -118,9 +115,9 @@
} on-error={
:set ($Metric->"resolve-failcnt") ($Metric->"resolve-failcnt" + 1);
:if ($Metric->"resolve-failcnt" = 3) do={
- $LogPrintExit2 warning $ScriptName ("Resolving name '" . $HostInfo->"resolve" . [ $IfThenElse \
+ $LogPrint warning $ScriptName ("Resolving name '" . $HostInfo->"resolve" . [ $IfThenElse \
($HostInfo->"resolve" != $HostInfo->"name") ("' for " . $Type . " '" . \
- $HostInfo->"name") "" ] . "' failed.") false;
+ $HostInfo->"name") "" ] . "' failed.");
}
}
}
@@ -129,8 +126,8 @@
:if ($HostVal->"status" = "up") do={
:local CountDown ($Metric->"count-down");
:if ($CountDown > 0) do={
- $LogPrintExit2 info $ScriptName \
- ("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is up.") false;
+ $LogPrint info $ScriptName \
+ ("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is up.");
:set ($Metric->"count-down") 0;
}
:set ($Metric->"count-up") ($Metric->"count-up" + 1);
@@ -178,11 +175,11 @@
}
:if ($Metric->"notified" = false || $Metric->"count-down" % 120 = 0 || \
$ScriptFromTerminalCached = true) do={
- $LogPrintExit2 [ $IfThenElse ($HostInfo->"no-down-notification" != true) info debug ] $ScriptName \
+ $LogPrint [ $IfThenElse ($HostInfo->"no-down-notification" != true) info debug ] $ScriptName \
("The " . $Type . " '" . $Name . "' (" . $HostDetails . ") is down for " . \
$Metric->"count-down" . " checks, " . [ $IfThenElse ($ParentNotified = false) [ $IfThenElse \
($Metric->"notified" = true) ("already notified.") ($CountDown - $Metric->"count-down" . \
- " to go.") ] ("parent " . $Type . " " . $Parent . " is down.") ]) false;
+ " to go.") ] ("parent " . $Type . " " . $Parent . " is down.") ]);
}
:if ((($CountDown * 2) - ($Metric->"count-down" * 3)) / 2 = 0 && \
[ :typeof ($HostInfo->"pre-down-hook") ] = "str") do={
diff --git a/news-and-changes.rsc b/news-and-changes.rsc
index 46b777a..6b0a538 100644
--- a/news-and-changes.rsc
+++ b/news-and-changes.rsc
@@ -47,6 +47,7 @@
120="Implemented a workaround in 'backup-cloud'. Now script should no longer just crash, but send notification with error.";
121="The 'wifiwave2' scripts are finally gone. Development continues with 'wifi' in RouterOS 7.13 and later.";
122="The global configuration was enhanced to support loading snippets. Configuration can be split off to scripts where name starts with 'global-config-overlay.d/'.";
+ 123="Introduced new function '\$LogPrint', and deprecated '\$LogPrintExit2'. Please update custom scripts if you use it.";
};
# Migration steps to be applied on script updates
diff --git a/ospf-to-leds.rsc b/ospf-to-leds.rsc
index 73c9922..a22e5a5 100644
--- a/ospf-to-leds.rsc
+++ b/ospf-to-leds.rsc
@@ -14,7 +14,7 @@
:do {
:local ScriptName [ :jobname ];
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -34,11 +34,11 @@
}
:if ($NeighborCount > 0 && $LEDType = "off") do={
- $LogPrintExit2 info $ScriptName ("OSPF instance " . $InstanceVal->"name" . " has " . $NeighborCount . " neighbors, led on!") false;
+ $LogPrint info $ScriptName ("OSPF instance " . $InstanceVal->"name" . " has " . $NeighborCount . " neighbors, led on!");
/system/leds/set type=on [ find where leds=$LED ];
}
:if ($NeighborCount = 0 && $LEDType = "on") do={
- $LogPrintExit2 info $ScriptName ("OSPF instance " . $InstanceVal->"name" . " has no neighbors, led off!") false;
+ $LogPrint info $ScriptName ("OSPF instance " . $InstanceVal->"name" . " has no neighbors, led off!");
/system/leds/set type=off [ find where leds=$LED ];
}
}
diff --git a/packages-update.rsc b/packages-update.rsc
index 634b7bb..22ea501 100644
--- a/packages-update.rsc
+++ b/packages-update.rsc
@@ -16,7 +16,7 @@
:global DownloadPackage;
:global Grep;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptFromTerminal;
:global ScriptLock;
@@ -29,7 +29,7 @@
:local ScriptName [ :tostr $1 ];
:global GetRandomNumber;
- :global LogPrintExit2;
+ :global LogPrint;
:global RebootForUpdate do={
/system/reboot;
@@ -39,8 +39,8 @@
/system/scheduler/add name="_RebootForUpdate" start-time=$StartTime interval=1d \
on-event=("/system/scheduler/remove \"_RebootForUpdate\"; " . \
":global RebootForUpdate; \$RebootForUpdate;");
- $LogPrintExit2 info $ScriptName ("Scheduled reboot for update at " . $StartTime . \
- " local time (" . [ /system/clock/get time-zone-name ] . ").") false;
+ $LogPrint info $ScriptName ("Scheduled reboot for update at " . $StartTime . \
+ " local time (" . [ /system/clock/get time-zone-name ] . ").");
:return true;
}
@@ -51,11 +51,12 @@
:local Update [ /system/package/update/get ];
:if ([ :typeof ($Update->"latest-version") ] = "nothing") do={
- $LogPrintExit2 warning $ScriptName ("Latest version is not known.") true;
+ $LogPrint warning $ScriptName ("Latest version is not known.");
+ :error false;
}
:if ($Update->"installed-version" = $Update->"latest-version") do={
- $LogPrintExit2 info $ScriptName ("Version " . $Update->"latest-version" . " is already installed.") false;
+ $LogPrint info $ScriptName ("Version " . $Update->"latest-version" . " is already installed.");
:error true;
}
@@ -63,8 +64,9 @@
:local NumLatest [ $VersionToNum ($Update->"latest-version") ];
:if ($NumInstalled < 0x070d0000 && $NumLatest > 0x070d0000) do={
- $LogPrintExit2 error $ScriptName ("Migration to wireless/wifi package in RouterOS " . \
- ($Update->"latest-version") . " is pending. Please update manually!") true;
+ $LogPrint error $ScriptName ("Migration to wireless/wifi package in RouterOS " . \
+ ($Update->"latest-version") . " is pending. Please update manually!");
+ :error false;
}
:local DoDowngrade false;
@@ -77,14 +79,16 @@
:put "Canceled...";
}
} else={
- $LogPrintExit2 warning $ScriptName ("Not installing downgrade automatically.") true;
+ $LogPrint warning $ScriptName ("Not installing downgrade automatically.");
+ :error false;
}
}
:foreach Package in=[ /system/package/find where !bundle ] do={
:local PkgName [ /system/package/get $Package name ];
:if ([ $DownloadPackage $PkgName ($Update->"latest-version") ] = false) do={
- $LogPrintExit2 error $ScriptName ("Download for package " . $PkgName . " failed, update aborted.") true;
+ $LogPrint error $ScriptName ("Download for package " . $PkgName . " failed, update aborted.");
+ :error false;
}
}
@@ -99,29 +103,31 @@
:foreach Order,Script in=$RunOrder do={
:set PackagesUpdateBackupFailure false;
:do {
- $LogPrintExit2 info $ScriptName ("Running backup script " . $Script . " before update.") false;
+ $LogPrint info $ScriptName ("Running backup script " . $Script . " before update.");
/system/script/run $Script;
} on-error={
:set PackagesUpdateBackupFailure true;
}
:if ($PackagesUpdateBackupFailure = true) do={
- $LogPrintExit2 warning $ScriptName ("Running backup script " . $Script . " before update failed!") false;
+ $LogPrint warning $ScriptName ("Running backup script " . $Script . " before update failed!");
:if ([ $ScriptFromTerminal $ScriptName ] = true) do={
:put "Do you want to continue anyway? [y/N]";
:if (([ /terminal/inkey timeout=60 ] % 32) = 25) do={
- $LogPrintExit2 info $ScriptName ("User requested to continue anyway.") false;
+ $LogPrint info $ScriptName ("User requested to continue anyway.");
} else={
- $LogPrintExit2 info $ScriptName ("Canceled update...") true;
+ $LogPrint info $ScriptName ("Canceled update...");
+ :error false;
}
} else={
- $LogPrintExit2 warning $ScriptName ("Canceled non-interactive update.") true;
+ $LogPrint warning $ScriptName ("Canceled non-interactive update.");
+ :error false;
}
}
}
:if ($DoDowngrade = true) do={
- $LogPrintExit2 info $ScriptName ("Rebooting for downgrade.") false;
+ $LogPrint info $ScriptName ("Rebooting for downgrade.");
:delay 1s;
/system/package/downgrade;
}
@@ -137,7 +143,7 @@
}
}
- $LogPrintExit2 info $ScriptName ("Rebooting for update.") false;
+ $LogPrint info $ScriptName ("Rebooting for update.");
:delay 1s;
/system/reboot;
} on-error={ }
diff --git a/ppp-on-up.rsc b/ppp-on-up.rsc
index 0cc2405..61766c0 100644
--- a/ppp-on-up.rsc
+++ b/ppp-on-up.rsc
@@ -14,26 +14,27 @@
:do {
:local ScriptName [ :jobname ];
- :global LogPrintExit2;
+ :global LogPrint;
:local Interface $interface;
:if ([ :typeof $Interface ] = "nothing") do={
- $LogPrintExit2 error $ScriptName ("This script is supposed to run from ppp on-up script hook.") true;
+ $LogPrint error $ScriptName ("This script is supposed to run from ppp on-up script hook.");
+ :error false;
}
:local IntName [ /interface/get $Interface name ];
- $LogPrintExit2 info $ScriptName ("PPP interface " . $IntName . " is up.") false;
+ $LogPrint info $ScriptName ("PPP interface " . $IntName . " is up.");
/ipv6/dhcp-client/release [ find where interface=$IntName !disabled ];
:foreach Script in=[ /system/script/find where source~("\n# provides: ppp-on-up\n") ] do={
:local ScriptName [ /system/script/get $Script name ];
:do {
- $LogPrintExit2 debug $ScriptName ("Running script: " . $ScriptName) false;
+ $LogPrint debug $ScriptName ("Running script: " . $ScriptName);
/system/script/run $Script;
} on-error={
- $LogPrintExit2 warning $ScriptName ("Running script '" . $ScriptName . "' failed!") false;
+ $LogPrint warning $ScriptName ("Running script '" . $ScriptName . "' failed!");
}
}
} on-error={ }
diff --git a/sms-action.rsc b/sms-action.rsc
index 11d3523..4c37565 100644
--- a/sms-action.rsc
+++ b/sms-action.rsc
@@ -16,13 +16,14 @@
:global SmsAction;
- :global LogPrintExit2;
+ :global LogPrint;
:global ValidateSyntax;
:local Action $action;
:if ([ :typeof $Action ] = "nothing") do={
- $LogPrintExit2 error $ScriptName ("This script is supposed to run from SMS hook with action=...") true;
+ $LogPrint error $ScriptName ("This script is supposed to run from SMS hook with action=...");
+ :error false;
}
:local Code ($SmsAction->$Action);
@@ -31,6 +32,6 @@
:delay 1s;
[ :parse $Code ];
} else={
- $LogPrintExit2 warning $ScriptName ("The code for action '" . $Action . "' failed syntax validation!") false;
+ $LogPrint warning $ScriptName ("The code for action '" . $Action . "' failed syntax validation!");
}
} on-error={ }
diff --git a/sms-forward.rsc b/sms-forward.rsc
index c745b81..b0966c3 100644
--- a/sms-forward.rsc
+++ b/sms-forward.rsc
@@ -19,7 +19,7 @@
:global SmsForwardHooks;
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global LogPrintOnce;
:global ScriptLock;
:global SendNotification2;
@@ -41,7 +41,7 @@
:local Settings [ /tool/sms/get ];
:if ([ /interface/lte/get ($Settings->"port") running ] != true) do={
- $LogPrintExit2 info $ScriptName ("The LTE interface is not in running state, skipping.") false;
+ $LogPrint info $ScriptName ("The LTE interface is not in running state, skipping.");
:error true;
}
@@ -56,7 +56,7 @@
:if ($Phone = $Settings->"allowed-number" && \
($SmsVal->"message")~("^:cmd " . $Settings->"secret" . " script ")) do={
- $LogPrintExit2 debug $ScriptName ("Removing SMS, which started a script.") false;
+ $LogPrint debug $ScriptName ("Removing SMS, which started a script.");
/tool/sms/inbox/remove $Sms;
} else={
:set Messages ($Messages . "\n\nOn " . $SmsVal->"timestamp" . \
@@ -64,20 +64,16 @@
:foreach Hook in=$SmsForwardHooks do={
:if ($Phone~($Hook->"allowed-number") && ($SmsVal->"message")~($Hook->"match")) do={
:if ([ $ValidateSyntax ($Hook->"command") ] = true) do={
- $LogPrintExit2 info $ScriptName ("Running hook '" . $Hook->"match" . "': " . \
- $Hook->"command") false;
+ $LogPrint info $ScriptName ("Running hook '" . $Hook->"match" . "': " . $Hook->"command");
:do {
:local Command [ :parse ($Hook->"command") ];
$Command Phone=$Phone Message=($SmsVal->"message");
- :set Messages ($Messages . "\n\nRan hook '" . $Hook->"match" . "':\n" . \
- $Hook->"command");
+ :set Messages ($Messages . "\n\nRan hook '" . $Hook->"match" . "':\n" . $Hook->"command");
} on-error={
- $LogPrintExit2 warning $ScriptName ("The code for hook '" . $Hook->"match" . \
- "' failed to run!") false;
+ $LogPrint warning $ScriptName ("The code for hook '" . $Hook->"match" . "' failed to run!");
}
} else={
- $LogPrintExit2 warning $ScriptName ("The code for hook '" . $Hook->"match" . \
- "' failed syntax validation!") false;
+ $LogPrint warning $ScriptName ("The code for hook '" . $Hook->"match" . "' failed syntax validation!");
}
}
}
diff --git a/telegram-chat.rsc b/telegram-chat.rsc
index 799569f..c81b714 100644
--- a/telegram-chat.rsc
+++ b/telegram-chat.rsc
@@ -30,7 +30,7 @@
:global EscapeForRegEx;
:global GetRandom20CharAlNum;
:global IfThenElse;
- :global LogPrintExit2;
+ :global LogPrint;
:global MAX;
:global MIN;
:global MkDir;
@@ -57,7 +57,8 @@
}
:if ([ $CertificateAvailable "Go Daddy Secure Certificate Authority - G2" ] = false) do={
- $LogPrintExit2 warning $ScriptName ("Downloading required certificate failed.") true;
+ $LogPrint warning $ScriptName ("Downloading required certificate failed.");
+ :error false;
}
$RandomDelay $TelegramRandomDelay;
@@ -72,7 +73,7 @@
:set TelegramRandomDelay [ $MAX 0 ($TelegramRandomDelay - 1) ];
} on-error={
:if ($I < 4) do={
- $LogPrintExit2 debug $ScriptName ("Fetch failed, " . $I . ". try.") false;
+ $LogPrint debug $ScriptName ("Fetch failed, " . $I . ". try.");
:set TelegramRandomDelay [ $MIN 15 ($TelegramRandomDelay + 5) ];
:delay (($I * $I) . "s");
}
@@ -81,7 +82,8 @@
}
:if ($Data = false) do={
- $LogPrintExit2 warning $ScriptName ("Failed getting updates from Telegram.") true;
+ $LogPrint warning $ScriptName ("Failed getting updates from Telegram.");
+ :error false;
}
:local UpdateID 0;
@@ -106,7 +108,7 @@
:if ($Trusted = true) do={
:local Done false;
:if ($Message->"text" = "?") do={
- $LogPrintExit2 info $ScriptName ("Sending notice for update " . $UpdateID . ".") false;
+ $LogPrint info $ScriptName ("Sending notice for update " . $UpdateID . ".");
$SendTelegram2 ({ origin=$ScriptName; chatid=($Chat->"id"); silent=true; replyto=($Message->"message_id"); \
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \
message=("Online, awaiting your commands!") });
@@ -118,8 +120,8 @@
} else={
:set TelegramChatActive false;
}
- $LogPrintExit2 info $ScriptName ("Now " . [ $IfThenElse $TelegramChatActive "active" "passive" ] . \
- " from update " . $UpdateID . "!") false;
+ $LogPrint info $ScriptName ("Now " . [ $IfThenElse $TelegramChatActive "active" "passive" ] . \
+ " from update " . $UpdateID . "!");
:set Done true;
}
:if ($Done = false && ($IsMyReply = 1 || ($IsReply = 0 && $TelegramChatActive = true)) && [ :len ($Message->"text") ] > 0) do={
@@ -127,9 +129,10 @@
:local State "";
:local File ("tmpfs/telegram-chat/" . [ $GetRandom20CharAlNum 6 ]);
:if ([ $MkDir "tmpfs/telegram-chat" ] = false) do={
- $LogPrintExit2 error $ScriptName ("Failed creating directory!") true;
+ $LogPrint error $ScriptName ("Failed creating directory!");
+ :error false;
}
- $LogPrintExit2 info $ScriptName ("Running command from update " . $UpdateID . ": " . $Message->"text") false;
+ $LogPrint info $ScriptName ("Running command from update " . $UpdateID . ": " . $Message->"text");
:execute script=(":do {\n" . $Message->"text" . "\n} on-error={ /file/add name=\"" . $File . ".failed\" };" . \
"/file/add name=\"" . $File . ".done\"") file=($File . "\00");
:if ([ $WaitForFile ($File . ".done") [ $EitherOr $TelegramChatRunTime 20s ] ] = false) do={
@@ -146,7 +149,7 @@
("Output exceeds file read size.") ("No output.") ] ]) });
/file/remove "tmpfs/telegram-chat";
} else={
- $LogPrintExit2 info $ScriptName ("The command from update " . $UpdateID . " failed syntax validation!") false;
+ $LogPrint info $ScriptName ("The command from update " . $UpdateID . " failed syntax validation!");
$SendTelegram2 ({ origin=$ScriptName; chatid=($Chat->"id"); silent=false; replyto=($Message->"message_id"); \
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \
message=("Command:\n" . $Message->"text" . "\n\nThe command failed syntax validation!") });
@@ -157,16 +160,16 @@
[ $IfThenElse ([ :len ($From->"username") ] = 0) "without username" ("'" . $From->"username" . "'") ] . \
" (ID " . $From->"id" . ") in update " . $UpdateID . "!");
:if ($Message->"text" ~ ("^! *" . [ $EscapeForRegEx $Identity ] . "\$")) do={
- $LogPrintExit2 warning $ScriptName $MessageText false;
+ $LogPrint warning $ScriptName $MessageText;
$SendTelegram2 ({ origin=$ScriptName; chatid=($Chat->"id"); silent=false; replyto=($Message->"message_id"); \
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \
message=("You are not trusted.") });
} else={
- $LogPrintExit2 info $ScriptName $MessageText false;
+ $LogPrint info $ScriptName $MessageText;
}
}
} else={
- $LogPrintExit2 debug $ScriptName ("Already handled update " . $UpdateID . ".") false;
+ $LogPrint debug $ScriptName ("Already handled update " . $UpdateID . ".");
}
}
:set TelegramChatOffset ([ :pick $TelegramChatOffset 1 3 ], \
diff --git a/update-gre-address.rsc b/update-gre-address.rsc
index 78705c5..74967cd 100644
--- a/update-gre-address.rsc
+++ b/update-gre-address.rsc
@@ -16,7 +16,7 @@
:local ScriptName [ :jobname ];
:global CharacterReplace;
- :global LogPrintExit2;
+ :global LogPrint;
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
@@ -33,7 +33,7 @@
:if ([ :typeof ($PeerVal->"dynamic-address") ] = "str" && \
($PeerVal->"dynamic-address" != $GreIntVal->"remote-address" || \
$GreIntVal->"disabled" = true)) do={
- $LogPrintExit2 info $ScriptName ("Updating remote address for interface " . $GreIntVal->"name" . " to " . $PeerVal->"dynamic-address") false;
+ $LogPrint info $ScriptName ("Updating remote address for interface " . $GreIntVal->"name" . " to " . $PeerVal->"dynamic-address");
/interface/gre/set remote-address=0.0.0.0 disabled=yes [ find where remote-address=$PeerVal->"dynamic-address" name!=$GreIntVal->"name" ];
/interface/gre/set $GreInt remote-address=($PeerVal->"dynamic-address") disabled=no;
}
diff --git a/update-tunnelbroker.rsc b/update-tunnelbroker.rsc
index 9f316e3..c76b7ec 100644
--- a/update-tunnelbroker.rsc
+++ b/update-tunnelbroker.rsc
@@ -17,7 +17,7 @@
:local ScriptName [ :jobname ];
:global CertificateAvailable;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -26,7 +26,8 @@
}
:if ([ $CertificateAvailable "Starfield Secure Certificate Authority - G2" ] = false) do={
- $LogPrintExit2 error $ScriptName ("Downloading required certificate failed.") true;
+ $LogPrint error $ScriptName ("Downloading required certificate failed.");
+ :error false;
}
:foreach Interface in=[ /interface/6to4/find where comment~"^tunnelbroker" !disabled ] do={
@@ -41,24 +42,25 @@
("https://ipv4.tunnelbroker.net/nic/update?hostname=" . $Comment->"id") \
user=($Comment->"user") password=($Comment->"pass") output=user as-value ]->"data");
} on-error={
- $LogPrintExit2 debug $ScriptName ("Failed downloading, " . $I . " retries pending.") false;
+ $LogPrint debug $ScriptName ("Failed downloading, " . $I . " retries pending.");
:delay 2s;
}
}
}
:if (!($Data ~ "^(good|nochg) ")) do={
- $LogPrintExit2 error $ScriptName ("Failed sending the local address to tunnelbroker or unexpected response!") true;
+ $LogPrint error $ScriptName ("Failed sending the local address to tunnelbroker or unexpected response!");
+ :error false;
}
:local PublicAddress [ :pick $Data ([ :find $Data " " ] + 1) [ :find $Data "\n" ] ];
:if ($PublicAddress != $InterfaceVal->"local-address") do={
:if ([ :len [ /ip/address find where address~("^" . $PublicAddress . "/") ] ] < 1) do={
- $LogPrintExit2 warning $ScriptName ("The address " . $PublicAddress . " is not configured on your device. NAT by ISP?") false;
+ $LogPrint warning $ScriptName ("The address " . $PublicAddress . " is not configured on your device. NAT by ISP?");
}
- $LogPrintExit2 info $ScriptName ("Local address changed, updating tunnel configuration with address: " . $PublicAddress) false;
+ $LogPrint info $ScriptName ("Local address changed, updating tunnel configuration with address: " . $PublicAddress);
/interface/6to4/set $Interface local-address=$PublicAddress;
}
}