mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
add script 'daily-psk-schedule'
This commit is contained in:
parent
e0e48573b9
commit
7b0b808c18
2 changed files with 23 additions and 12 deletions
12
daily-psk
12
daily-psk
|
@ -53,16 +53,6 @@
|
|||
:return $return;
|
||||
}
|
||||
|
||||
# check mail server
|
||||
:if ([ / tool netwatch get [ find where comment=[ / tool e-mail get address ] ] status ] != "up" ) do={
|
||||
:error "Mail server is not up.";
|
||||
}
|
||||
|
||||
# check time
|
||||
:if ([ / system ntp client get status ] != "synchronized") do={
|
||||
:error "Time is not yet synchronized from ntp.";
|
||||
}
|
||||
|
||||
:local date [ / system clock get date ];
|
||||
:local newpsk [ $GeneratePSK $date ];
|
||||
|
||||
|
@ -111,5 +101,3 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/ system scheduler set disabled=yes [ find where name=daily-psk disabled=no ];
|
||||
|
|
23
daily-psk-schedule
Normal file
23
daily-psk-schedule
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!rsc
|
||||
# RouterOS script: daily-psk-schedule
|
||||
# Copyright (c) 2013-2018 Christian Hesse <mail@eworm.de>
|
||||
#
|
||||
# schedule daily-psk on startup
|
||||
|
||||
:local scheduler [ / system scheduler find where name=daily-psk-schedule ];
|
||||
|
||||
:if ([ / system scheduler get $scheduler interval ] = "00:00:00") do={
|
||||
/ system scheduler set interval=15s $scheduler;
|
||||
} else={
|
||||
:if ([ / tool netwatch get [ find where comment=[ / tool e-mail get address ] ] status ] != "up" ) do={
|
||||
:error "Mail server is not up.";
|
||||
}
|
||||
|
||||
:if ([ / system ntp client get status ] != "synchronized") do={
|
||||
:error "Time is not yet synchronized from ntp.";
|
||||
}
|
||||
|
||||
/ system script run daily-psk;
|
||||
|
||||
/ system scheduler set interval=0s $scheduler;
|
||||
}
|
Loading…
Reference in a new issue