2018-09-26 22:18:43 +00:00
|
|
|
#!rsc
|
2018-07-05 13:29:26 +00:00
|
|
|
# RouterOS script: rotate-ntp
|
2019-01-01 20:19:19 +00:00
|
|
|
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
|
2018-07-05 13:29:26 +00:00
|
|
|
#
|
|
|
|
# rotate the ntp servers
|
|
|
|
|
|
|
|
:global "ntp-pool";
|
|
|
|
|
|
|
|
:local ntp1 [ :resolve ("0." . $"ntp-pool") ];
|
|
|
|
:local ntp2 [ :resolve ("1." . $"ntp-pool") ];
|
|
|
|
|
2018-09-18 21:46:24 +00:00
|
|
|
:if ([ / system ntp client get enabled ] != true) do={
|
|
|
|
:log warning "NTP client is not enabled!";
|
|
|
|
}
|
|
|
|
|
2018-07-05 13:29:26 +00:00
|
|
|
:log info ("Updating NTP servers to " . $ntp1 . " and " . $ntp2);
|
|
|
|
/ system ntp client set primary-ntp=$ntp1 secondary-ntp=$ntp2;
|