daily-psk: wait to be fully connected

This commit is contained in:
Christian Hesse 2020-05-27 00:21:30 +02:00
parent 7ecda2204f
commit 7597911672
4 changed files with 10 additions and 4 deletions

View file

@ -15,8 +15,9 @@
:global SendNotification; :global SendNotification;
:global UrlEncode; :global UrlEncode;
:global WaitForFile; :global WaitForFile;
:global WaitFullyConnected;
:local Seen [ :toarray "" ]; $WaitFullyConnected;
# return pseudo-random string for PSK # return pseudo-random string for PSK
:local GeneratePSK do={ :local GeneratePSK do={
@ -48,6 +49,7 @@
($DailyPskSecrets->2->$WeekDay)); ($DailyPskSecrets->2->$WeekDay));
} }
:local Seen [ :toarray "" ];
:local Date [ / system clock get date ]; :local Date [ / system clock get date ];
:local NewPsk [ $GeneratePSK $Date ]; :local NewPsk [ $GeneratePSK $Date ];

View file

@ -15,8 +15,9 @@
:global SendNotification; :global SendNotification;
:global UrlEncode; :global UrlEncode;
:global WaitForFile; :global WaitForFile;
:global WaitFullyConnected;
:local Seen [ :toarray "" ]; $WaitFullyConnected;
# return pseudo-random string for PSK # return pseudo-random string for PSK
:local GeneratePSK do={ :local GeneratePSK do={
@ -48,6 +49,7 @@
($DailyPskSecrets->2->$WeekDay)); ($DailyPskSecrets->2->$WeekDay));
} }
:local Seen [ :toarray "" ];
:local Date [ / system clock get date ]; :local Date [ / system clock get date ];
:local NewPsk [ $GeneratePSK $Date ]; :local NewPsk [ $GeneratePSK $Date ];

View file

@ -16,8 +16,9 @@
:global SendNotification; :global SendNotification;
:global UrlEncode; :global UrlEncode;
:global WaitForFile; :global WaitForFile;
:global WaitFullyConnected;
:local Seen [ :toarray "" ]; $WaitFullyConnected;
# return pseudo-random string for PSK # return pseudo-random string for PSK
:local GeneratePSK do={ :local GeneratePSK do={
@ -49,6 +50,7 @@
($DailyPskSecrets->2->$WeekDay)); ($DailyPskSecrets->2->$WeekDay));
} }
:local Seen [ :toarray "" ];
:local Date [ / system clock get date ]; :local Date [ / system clock get date ];
:local NewPsk [ $GeneratePSK $Date ]; :local NewPsk [ $GeneratePSK $Date ];

View file

@ -28,7 +28,7 @@ For local interface:
And add schedulers to run the script: 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 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. These will update the passphrase on boot and nightly at 3:00.