aboutsummaryrefslogtreecommitdiffstats
path: root/daily-psk-schedule
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-10-12 13:33:25 +0200
committerGravatar Christian Hesse <mail@eworm.de>2018-10-12 13:39:40 +0200
commit7b0b808c1838924e0b38f6aa216ee8e711d4196c (patch)
tree1d7a7edc2b0bf91be382b2ba527d593b85b50904 /daily-psk-schedule
parente0e48573b995d92ce13b9cea582ee8d939756270 (diff)
add script 'daily-psk-schedule'
Diffstat (limited to 'daily-psk-schedule')
-rw-r--r--daily-psk-schedule23
1 files changed, 23 insertions, 0 deletions
diff --git a/daily-psk-schedule b/daily-psk-schedule
new file mode 100644
index 0000000..7866dba
--- /dev/null
+++ b/daily-psk-schedule
@@ -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;
+}