aboutsummaryrefslogblamecommitdiffstats
path: root/rotate-ntp
blob: fc9aeea600f3871a7fff338b840f0cc270d6229b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
     
                             
                                                         






                                              


                                                      
                                                                 
#!rsc
# RouterOS script: rotate-ntp
# Copyright (c) 2013-2019 Christian Hesse <mail@eworm.de>
#
# rotate the ntp servers

:global "ntp-pool";

:local ntp1 [ :resolve ("0." . $"ntp-pool") ];
:local ntp2 [ :resolve ("1." . $"ntp-pool") ];

: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;