mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
Merge branch 'empty-array' into next
This commit is contained in:
commit
b67b9ec1c1
19 changed files with 30 additions and 30 deletions
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
:global Read;
|
:global Read;
|
||||||
|
|
||||||
:local Seen [ :toarray "" ];
|
:local Seen ({});
|
||||||
:local Shown [ :toarray "" ];
|
:local Shown ({});
|
||||||
|
|
||||||
:foreach AccList in=[ /caps-man/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
|
:foreach AccList in=[ /caps-man/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
|
||||||
:local Mac [ /caps-man/access-list/get $AccList mac-address ];
|
:local Mac [ /caps-man/access-list/get $AccList mac-address ];
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
:global Read;
|
:global Read;
|
||||||
|
|
||||||
:local Seen [ :toarray "" ];
|
:local Seen ({});
|
||||||
:local Shown [ :toarray "" ];
|
:local Shown ({});
|
||||||
|
|
||||||
:foreach AccList in=[ /interface/wireless/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
|
:foreach AccList in=[ /interface/wireless/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
|
||||||
:local Mac [ /interface/wireless/access-list/get $AccList mac-address ];
|
:local Mac [ /interface/wireless/access-list/get $AccList mac-address ];
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
|
|
||||||
:global Read;
|
:global Read;
|
||||||
|
|
||||||
:local Seen [ :toarray "" ];
|
:local Seen ({});
|
||||||
:local Shown [ :toarray "" ];
|
:local Shown ({});
|
||||||
|
|
||||||
:foreach AccList in=[ /%PATH%/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
|
:foreach AccList in=[ /%PATH%/access-list/find where mac-address!="00:00:00:00:00:00" ] do={
|
||||||
:local Mac [ /%PATH%/access-list/get $AccList mac-address ];
|
:local Mac [ /%PATH%/access-list/get $AccList mac-address ];
|
||||||
|
|
|
@ -50,7 +50,7 @@ $WaitFullyConnected;
|
||||||
:local FilePath ($0 . "/" . $FileName);
|
:local FilePath ($0 . "/" . $FileName);
|
||||||
:local BackupFile "none";
|
:local BackupFile "none";
|
||||||
:local ConfigFile "none";
|
:local ConfigFile "none";
|
||||||
:local Attach [ :toarray "" ];
|
:local Attach ({});
|
||||||
|
|
||||||
# binary backup
|
# binary backup
|
||||||
:if ($BackupSendBinary = true) do={
|
:if ($BackupSendBinary = true) do={
|
||||||
|
|
|
@ -35,10 +35,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :typeof $CheckHealthLast ] != "array") do={
|
:if ([ :typeof $CheckHealthLast ] != "array") do={
|
||||||
:set CheckHealthLast [ :toarray "" ];
|
:set CheckHealthLast ({});
|
||||||
}
|
}
|
||||||
:if ([ :typeof $CheckHealthTemperatureNotified ] != "array") do={
|
:if ([ :typeof $CheckHealthTemperatureNotified ] != "array") do={
|
||||||
:set CheckHealthTemperatureNotified [ :toarray "" ];
|
:set CheckHealthTemperatureNotified ({});
|
||||||
}
|
}
|
||||||
|
|
||||||
$ScriptLock $0;
|
$ScriptLock $0;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
:global SentLteFirmwareUpgradeNotification;
|
:global SentLteFirmwareUpgradeNotification;
|
||||||
|
|
||||||
:if ([ :typeof $SentLteFirmwareUpgradeNotification ] != "array") do={
|
:if ([ :typeof $SentLteFirmwareUpgradeNotification ] != "array") do={
|
||||||
:global SentLteFirmwareUpgradeNotification [ :toarray "" ];
|
:global SentLteFirmwareUpgradeNotification ({});
|
||||||
}
|
}
|
||||||
|
|
||||||
:local CheckInterface do={
|
:local CheckInterface do={
|
||||||
|
|
|
@ -55,7 +55,7 @@ $WaitFullyConnected;
|
||||||
($DailyPskSecrets->2->$WeekDay));
|
($DailyPskSecrets->2->$WeekDay));
|
||||||
}
|
}
|
||||||
|
|
||||||
:local Seen [ :toarray "" ];
|
:local Seen ({});
|
||||||
:local Date [ /system/clock/get date ];
|
:local Date [ /system/clock/get date ];
|
||||||
:local NewPsk [ $GeneratePSK $Date ];
|
:local NewPsk [ $GeneratePSK $Date ];
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ $WaitFullyConnected;
|
||||||
($DailyPskSecrets->2->$WeekDay));
|
($DailyPskSecrets->2->$WeekDay));
|
||||||
}
|
}
|
||||||
|
|
||||||
:local Seen [ :toarray "" ];
|
:local Seen ({});
|
||||||
:local Date [ /system/clock/get date ];
|
:local Date [ /system/clock/get date ];
|
||||||
:local NewPsk [ $GeneratePSK $Date ];
|
:local NewPsk [ $GeneratePSK $Date ];
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ $WaitFullyConnected;
|
||||||
($DailyPskSecrets->2->$WeekDay));
|
($DailyPskSecrets->2->$WeekDay));
|
||||||
}
|
}
|
||||||
|
|
||||||
:local Seen [ :toarray "" ];
|
:local Seen ({});
|
||||||
:local Date [ /system/clock/get date ];
|
:local Date [ /system/clock/get date ];
|
||||||
:local NewPsk [ $GeneratePSK $Date ];
|
:local NewPsk [ $GeneratePSK $Date ];
|
||||||
|
|
||||||
|
|
|
@ -585,7 +585,7 @@
|
||||||
|
|
||||||
# prepare NotificationFunctions array
|
# prepare NotificationFunctions array
|
||||||
:if ([ :typeof $NotificationFunctions ] != "array") do={
|
:if ([ :typeof $NotificationFunctions ] != "array") do={
|
||||||
:set NotificationFunctions [ :toarray "" ];
|
:set NotificationFunctions ({});
|
||||||
}
|
}
|
||||||
|
|
||||||
# send notification via e-mail - expects one array argument
|
# send notification via e-mail - expects one array argument
|
||||||
|
@ -612,7 +612,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :typeof $EmailQueue ] = "nothing") do={
|
:if ([ :typeof $EmailQueue ] = "nothing") do={
|
||||||
:set EmailQueue [ :toarray "" ];
|
:set EmailQueue ({});
|
||||||
}
|
}
|
||||||
:local Signature [ /system/note/get note ];
|
:local Signature [ /system/note/get note ];
|
||||||
:set ($EmailQueue->[ :len $EmailQueue ]) {
|
:set ($EmailQueue->[ :len $EmailQueue ]) {
|
||||||
|
@ -634,7 +634,7 @@
|
||||||
:if ([ :typeof $Source ] != "array") do={
|
:if ([ :typeof $Source ] != "array") do={
|
||||||
:set Source [ :tostr $1 ];
|
:set Source [ :tostr $1 ];
|
||||||
}
|
}
|
||||||
:local Result [ :toarray "" ];
|
:local Result ({});
|
||||||
:foreach KeyValue in=[ :toarray $Source ] do={
|
:foreach KeyValue in=[ :toarray $Source ] do={
|
||||||
:if ([ :find $KeyValue "=" ]) do={
|
:if ([ :find $KeyValue "=" ]) do={
|
||||||
:set ($Result->[ :pick $KeyValue 0 [ :find $KeyValue "=" ] ]) \
|
:set ($Result->[ :pick $KeyValue 0 [ :find $KeyValue "=" ] ]) \
|
||||||
|
@ -974,10 +974,10 @@
|
||||||
|
|
||||||
:global ScriptLockOrder;
|
:global ScriptLockOrder;
|
||||||
:if ([ :typeof $ScriptLockOrder ] = "nothing") do={
|
:if ([ :typeof $ScriptLockOrder ] = "nothing") do={
|
||||||
:set ScriptLockOrder [ :toarray "" ];
|
:set ScriptLockOrder ({});
|
||||||
}
|
}
|
||||||
:if ([ :typeof ($ScriptLockOrder->$Script) ] = "nothing") do={
|
:if ([ :typeof ($ScriptLockOrder->$Script) ] = "nothing") do={
|
||||||
:set ($ScriptLockOrder->$Script) [ :toarray "" ];
|
:set ($ScriptLockOrder->$Script) ({});
|
||||||
}
|
}
|
||||||
|
|
||||||
:local JobCount do={
|
:local JobCount do={
|
||||||
|
@ -1052,7 +1052,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:set ($ScriptLockOrder->$Script) [ :toarray "" ];
|
:set ($ScriptLockOrder->$Script) ({});
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :len [ /system/script/find where name=$Script ] ] = 0) do={
|
:if ([ :len [ /system/script/find where name=$Script ] ] = 0) do={
|
||||||
|
@ -1065,7 +1065,7 @@
|
||||||
|
|
||||||
:if ([ $TicketCount $Script ] >= [ $JobCount $Script ]) do={
|
:if ([ $TicketCount $Script ] >= [ $JobCount $Script ]) do={
|
||||||
$LogPrintExit2 error $0 ("More tickets than running scripts '" . $Script . "', resetting!") false;
|
$LogPrintExit2 error $0 ("More tickets than running scripts '" . $Script . "', resetting!") false;
|
||||||
:set ($ScriptLockOrder->$Script) [ :toarray "" ];
|
:set ($ScriptLockOrder->$Script) ({});
|
||||||
/system/script/job/remove [ find where script=$Script ];
|
/system/script/job/remove [ find where script=$Script ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ $ScriptLock $0 false 10;
|
||||||
$LogPrintExit2 debug $0 ("More invocations are waiting, exiting early.") true;
|
$LogPrintExit2 debug $0 ("More invocations are waiting, exiting early.") true;
|
||||||
}
|
}
|
||||||
|
|
||||||
:local RunOrder [ :toarray "" ];
|
:local RunOrder ({});
|
||||||
|
|
||||||
:foreach Script in=[ /system/script/find where source~("\n# provides: lease-script, ") ] do={
|
:foreach Script in=[ /system/script/find where source~("\n# provides: lease-script, ") ] do={
|
||||||
:local Name [ /system/script/get $Script name ];
|
:local Name [ /system/script/get $Script name ];
|
||||||
|
|
|
@ -46,7 +46,7 @@ $ScriptLock $0;
|
||||||
:local Messages "";
|
:local Messages "";
|
||||||
:local Warning false;
|
:local Warning false;
|
||||||
:local MessageVal;
|
:local MessageVal;
|
||||||
:local MessageDups [ :toarray "" ];
|
:local MessageDups ({});
|
||||||
|
|
||||||
:local LogForwardFilterLogForwarding ("^Error sending e-mail <(" . \
|
:local LogForwardFilterLogForwarding ("^Error sending e-mail <(" . \
|
||||||
[ $EscapeForRegEx [ $QuotedPrintable ("[" . $Identity . "] " . \
|
[ $EscapeForRegEx [ $QuotedPrintable ("[" . $Identity . "] " . \
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
:global ParseKeyValueStore;
|
:global ParseKeyValueStore;
|
||||||
|
|
||||||
:local InterfaceReEnable [ :toarray "" ];
|
:local InterfaceReEnable ({});
|
||||||
:foreach BridgePort in=[ /interface/bridge/port/find where !(comment=[]) ] do={
|
:foreach BridgePort in=[ /interface/bridge/port/find where !(comment=[]) ] do={
|
||||||
:local BridgePortVal [ /interface/bridge/port/get $BridgePort ];
|
:local BridgePortVal [ /interface/bridge/port/get $BridgePort ];
|
||||||
:foreach Config,BridgeDefault in=[ $ParseKeyValueStore ($BridgePortVal->"comment") ] do={
|
:foreach Config,BridgeDefault in=[ $ParseKeyValueStore ($BridgePortVal->"comment") ] do={
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
:global ParseKeyValueStore;
|
:global ParseKeyValueStore;
|
||||||
|
|
||||||
:local InterfaceReEnable [ :toarray "" ];
|
:local InterfaceReEnable ({});
|
||||||
:foreach BridgePort in=[ /interface/bridge/port/find where !(comment=[]) ] do={
|
:foreach BridgePort in=[ /interface/bridge/port/find where !(comment=[]) ] do={
|
||||||
:local BridgePortVal [ /interface/bridge/port/get $BridgePort ];
|
:local BridgePortVal [ /interface/bridge/port/get $BridgePort ];
|
||||||
:foreach Config,Vlan in=[ $ParseKeyValueStore ($BridgePortVal->"comment") ] do={
|
:foreach Config,Vlan in=[ $ParseKeyValueStore ($BridgePortVal->"comment") ] do={
|
||||||
|
|
|
@ -129,7 +129,7 @@
|
||||||
$LogPrintExit2 info $0 ("Failed sending Matrix notification! Queuing...") false;
|
$LogPrintExit2 info $0 ("Failed sending Matrix notification! Queuing...") false;
|
||||||
|
|
||||||
:if ([ :typeof $MatrixQueue ] = "nothing") do={
|
:if ([ :typeof $MatrixQueue ] = "nothing") do={
|
||||||
:set MatrixQueue [ :toarray "" ];
|
:set MatrixQueue ({});
|
||||||
}
|
}
|
||||||
:local Text ([ $SymbolForNotification "alarm-clock" ] . \
|
:local Text ([ $SymbolForNotification "alarm-clock" ] . \
|
||||||
"This message was queued since " . [ /system/clock/get date ] . \
|
"This message was queued since " . [ /system/clock/get date ] . \
|
||||||
|
|
|
@ -139,7 +139,7 @@
|
||||||
$LogPrintExit2 info $0 ("Failed sending telegram notification! Queuing...") false;
|
$LogPrintExit2 info $0 ("Failed sending telegram notification! Queuing...") false;
|
||||||
|
|
||||||
:if ([ :typeof $TelegramQueue ] = "nothing") do={
|
:if ([ :typeof $TelegramQueue ] = "nothing") do={
|
||||||
:set TelegramQueue [ :toarray "" ];
|
:set TelegramQueue ({});
|
||||||
}
|
}
|
||||||
:set Text ($Text . [ $UrlEncode ("\n" . [ $SymbolForNotification "alarm-clock" ] . \
|
:set Text ($Text . [ $UrlEncode ("\n" . [ $SymbolForNotification "alarm-clock" ] . \
|
||||||
[ $EscapeMD ("This message was queued since " . [ /system/clock/get date ] . \
|
[ $EscapeMD ("This message was queued since " . [ /system/clock/get date ] . \
|
||||||
|
|
|
@ -21,8 +21,8 @@ $ScriptLock $0;
|
||||||
$LogPrintExit2 info $0 ("System just booted, giving netwatch some time to settle.") true;
|
$LogPrintExit2 info $0 ("System just booted, giving netwatch some time to settle.") true;
|
||||||
}
|
}
|
||||||
|
|
||||||
:local DnsServers [ :toarray "" ];
|
:local DnsServers ({});
|
||||||
:local DnsFallback [ :toarray "" ];
|
:local DnsFallback ({});
|
||||||
:local DnsCurrent [ /ip/dns/get servers ];
|
:local DnsCurrent [ /ip/dns/get servers ];
|
||||||
|
|
||||||
:foreach Host in=[ /tool/netwatch/find where comment~"dns" !disabled ] do={
|
:foreach Host in=[ /tool/netwatch/find where comment~"dns" !disabled ] do={
|
||||||
|
|
|
@ -56,7 +56,7 @@ $ScriptLock $0;
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :typeof $NetwatchNotify ] = "nothing") do={
|
:if ([ :typeof $NetwatchNotify ] = "nothing") do={
|
||||||
:set NetwatchNotify [ :toarray "" ];
|
:set NetwatchNotify ({});
|
||||||
}
|
}
|
||||||
|
|
||||||
:foreach Host in=[ /tool/netwatch/find where comment~"notify" !disabled ] do={
|
:foreach Host in=[ /tool/netwatch/find where comment~"notify" !disabled ] do={
|
||||||
|
|
|
@ -33,7 +33,7 @@ $WaitFullyConnected;
|
||||||
:while ([ :len [ /tool/sms/inbox/find ] ] > 0) do={
|
:while ([ :len [ /tool/sms/inbox/find ] ] > 0) do={
|
||||||
:local Phone [ /tool/sms/inbox/get ([ find ]->0) phone ];
|
:local Phone [ /tool/sms/inbox/get ([ find ]->0) phone ];
|
||||||
:local Messages "";
|
:local Messages "";
|
||||||
:local Delete [ :toarray "" ];
|
:local Delete ({});
|
||||||
|
|
||||||
:foreach Sms in=[ /tool/sms/inbox/find where phone=$Phone ] do={
|
:foreach Sms in=[ /tool/sms/inbox/find where phone=$Phone ] do={
|
||||||
:local SmsVal [ /tool/sms/inbox/get $Sms ];
|
:local SmsVal [ /tool/sms/inbox/get $Sms ];
|
||||||
|
|
Loading…
Reference in a new issue