2018-10-12 11:33:25 +00:00
|
|
|
#!rsc
|
|
|
|
# RouterOS script: daily-psk-schedule
|
2019-01-01 20:19:19 +00:00
|
|
|
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
|
2018-10-12 11:33:25 +00:00
|
|
|
#
|
|
|
|
# schedule daily-psk on startup
|
|
|
|
|
|
|
|
:local scheduler [ / system scheduler find where name=daily-psk-schedule ];
|
|
|
|
|
2019-01-03 09:23:02 +00:00
|
|
|
:if ([ / system scheduler get $scheduler interval ] = 0s) do={
|
2018-10-12 11:33:25 +00:00
|
|
|
/ 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;
|
|
|
|
}
|