mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
20 lines
582 B
Text
20 lines
582 B
Text
#!rsc
|
|
# RouterOS script: rotate-ntp
|
|
# Copyright (c) 2013-2020 Christian Hesse <mail@eworm.de>
|
|
#
|
|
# rotate the ntp servers
|
|
# https://git.eworm.de/cgit/routeros-scripts/about/doc/rotate-ntp.md
|
|
|
|
:global NtpPool;
|
|
|
|
:global LogPrintExit;
|
|
|
|
:local Ntp1 [ :resolve ("0." . $NtpPool) ];
|
|
:local Ntp2 [ :resolve ("1." . $NtpPool) ];
|
|
|
|
:if ([ / system ntp client get enabled ] != true) do={
|
|
$LogPrintExit warning "NTP client is not enabled!" true;
|
|
}
|
|
|
|
$LogPrintExit info ("Updating NTP servers to " . $Ntp1 . " and " . $Ntp2) false;
|
|
/ system ntp client set primary-ntp=$Ntp1 secondary-ntp=$Ntp2;
|