From 75979116727eed330b404dfb9c01354704193fc9 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 27 May 2020 00:21:30 +0200 Subject: [PATCH] daily-psk: wait to be fully connected --- daily-psk.capsman | 4 +++- daily-psk.local | 4 +++- daily-psk.template | 4 +++- doc/daily-psk.md | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/daily-psk.capsman b/daily-psk.capsman index 623ef0c..a457454 100644 --- a/daily-psk.capsman +++ b/daily-psk.capsman @@ -15,8 +15,9 @@ :global SendNotification; :global UrlEncode; :global WaitForFile; +:global WaitFullyConnected; -:local Seen [ :toarray "" ]; +$WaitFullyConnected; # return pseudo-random string for PSK :local GeneratePSK do={ @@ -48,6 +49,7 @@ ($DailyPskSecrets->2->$WeekDay)); } +:local Seen [ :toarray "" ]; :local Date [ / system clock get date ]; :local NewPsk [ $GeneratePSK $Date ]; diff --git a/daily-psk.local b/daily-psk.local index 6245ebe..d4d6a72 100644 --- a/daily-psk.local +++ b/daily-psk.local @@ -15,8 +15,9 @@ :global SendNotification; :global UrlEncode; :global WaitForFile; +:global WaitFullyConnected; -:local Seen [ :toarray "" ]; +$WaitFullyConnected; # return pseudo-random string for PSK :local GeneratePSK do={ @@ -48,6 +49,7 @@ ($DailyPskSecrets->2->$WeekDay)); } +:local Seen [ :toarray "" ]; :local Date [ / system clock get date ]; :local NewPsk [ $GeneratePSK $Date ]; diff --git a/daily-psk.template b/daily-psk.template index 3181b1a..e9f061f 100644 --- a/daily-psk.template +++ b/daily-psk.template @@ -16,8 +16,9 @@ :global SendNotification; :global UrlEncode; :global WaitForFile; +:global WaitFullyConnected; -:local Seen [ :toarray "" ]; +$WaitFullyConnected; # return pseudo-random string for PSK :local GeneratePSK do={ @@ -49,6 +50,7 @@ ($DailyPskSecrets->2->$WeekDay)); } +:local Seen [ :toarray "" ]; :local Date [ / system clock get date ]; :local NewPsk [ $GeneratePSK $Date ]; diff --git a/doc/daily-psk.md b/doc/daily-psk.md index 26ab3d1..c6055d6 100644 --- a/doc/daily-psk.md +++ b/doc/daily-psk.md @@ -28,7 +28,7 @@ For local interface: And add schedulers to run the script: / system scheduler add interval=1d name=daily-psk-nightly on-event="/ system script run daily-psk.local;" start-date=may/23/2018 start-time=03:00:00; - / system scheduler add name=daily-psk-startup on-event=":global WaitFullyConnected; / system script { run global-wait; \$WaitFullyConnected; run daily-psk.local; }" start-time=startup; + / system scheduler add name=daily-psk-startup on-event="/ system script { run global-wait; run daily-psk.local; }" start-time=startup; These will update the passphrase on boot and nightly at 3:00.