aboutsummaryrefslogtreecommitdiffstats
path: root/rotate-ntp
blob: f342f98ed28a7ab0a0f059e6d3a120a3b3c9a581 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!rsc
# RouterOS script: rotate-ntp
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
#
# rotate the ntp servers

:global NtpPool;

:local Ntp1 [ :resolve ("0." . $NtpPool) ];
:local Ntp2 [ :resolve ("1." . $NtpPool) ];

:if ([ / system ntp client get enabled ] != true) do={
  :log warning "NTP client is not enabled!";
}

:log info ("Updating NTP servers to " . $Ntp1 . " and " . $Ntp2);
/ system ntp client set primary-ntp=$Ntp1 secondary-ntp=$Ntp2;