aboutsummaryrefslogtreecommitdiffstats
path: root/daily-psk.template.rsc
diff options
context:
space:
mode:
Diffstat (limited to 'daily-psk.template.rsc')
-rw-r--r--daily-psk.template.rsc25
1 files changed, 14 insertions, 11 deletions
diff --git a/daily-psk.template.rsc b/daily-psk.template.rsc
index 35fa82c..5a1df2f 100644
--- a/daily-psk.template.rsc
+++ b/daily-psk.template.rsc
@@ -1,21 +1,22 @@
#!rsc by RouterOS
# RouterOS script: daily-psk%TEMPL%
-# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
+# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
# Michael Gisbers <michael@gisbers.de>
-# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
+# https://rsc.eworm.de/COPYING.md
#
-# requires RouterOS, version=7.13
+# requires RouterOS, version=7.15
#
# update daily PSK (pre shared key)
-# https://git.eworm.de/cgit/routeros-scripts/about/doc/daily-psk.md
+# https://rsc.eworm.de/doc/daily-psk.md
#
# !! This is just a template to generate the real script!
# !! Pattern '%TEMPL%' is replaced, paths are filtered.
-:global GlobalFunctionsReady;
-:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
-
-:do {
+:local ExitOK false;
+:onerror Err {
+ :global GlobalConfigReady; :global GlobalFunctionsReady;
+ :retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
+ do={ :error ("Global config and/or functions not ready."); }; } delay=500ms max=50;
:local ScriptName [ :jobname ];
:global DailyPskMatchComment;
@@ -24,7 +25,6 @@
:global FormatLine;
:global LogPrint;
- :global RequiredRouterOS;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
@@ -33,6 +33,7 @@
:global WaitFullyConnected;
:if ([ $ScriptLock $ScriptName ] = false) do={
+ :set ExitOK true;
:error false;
}
$WaitFullyConnected;
@@ -86,7 +87,7 @@
/interface/wireless/access-list/set $AccList private-pre-shared-key=$NewPsk;
:if ([ :len [ /caps-man/actual-interface-configuration/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={
- :if ([ $RequiredRouterOS $ScriptName "7.15beta8" false ] = false || [ :len [ /interface/wifi/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={
+ :if ([ :len [ /interface/wifi/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={
:if ([ :len [ /interface/wireless/find where name=$IntName !disabled ] ] = 1) do={
:if ($Seen->$Ssid = 1) do={
$LogPrint debug $ScriptName ("Already sent a mail for SSID " . $Ssid . ", skipping.");
@@ -105,4 +106,6 @@
}
}
}
-} on-error={ }
+} do={
+ :global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
+}