aboutsummaryrefslogtreecommitdiffstats
path: root/daily-psk-schedule
blob: 7e745e1a33c16a83740b2bfc7f8867d8448b6ff2 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!rsc
# RouterOS script: daily-psk-schedule
# Copyright (c) 2013-2020 Christian Hesse <mail@eworm.de>
#
# schedule daily-psk on startup

:global MailServerIsUp;
:global TimeIsSync;

:local Scheduler [ / system scheduler find where name="daily-psk-schedule" ];

:if ([ / system scheduler get $Scheduler interval ] = 0s) do={
  / system scheduler set interval=15s $Scheduler;
} else={
  :if ($MailServerIsUp = false) do={
    :log warning "Mail server is not up.";
    :error "Warning: See log for details.";
  }

  :if ($TimeIsSync = false) do={
    :log warning "Time is not yet synchronized.";
    :error "Warning: See log for details.";
  }

  / system script run [ find where name~"^daily-psk\\.(capsman|local)\$" ];

  / system scheduler set interval=0s $Scheduler;
}