diff options
Diffstat (limited to 'scripts/ntpd-set.sh')
-rwxr-xr-x | scripts/ntpd-set.sh | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/scripts/ntpd-set.sh b/scripts/ntpd-set.sh deleted file mode 100755 index d6fd8f25b..000000000 --- a/scripts/ntpd-set.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -max_attempts=4 - -# This script takes a list of ntp servers and passes them to ntpd to set the -# system time. If a /etc/ntpd.conf file exists, the servers there are used, -# if not, some default values are passed -set_time() { - # -q flag makes ntpd exit after setting the time once - ntpd -q -n -p "$1" -} - -check_time() { - for attempt in $(seq "$max_attempts"); do - for arg ; do - echo $arg - if set_time "$arg" ; then - return 0 - fi - done - sleep 2 - done - return 1 -} - -if [ -f /etc/ntpd.conf ]; then - server_list=`cat /etc/ntpd.conf | sed ':a;N;$!ba;s/\n/ /g;s/server//g'` - check_time $server_list -else - # Use a default list if there's no config - check_time 0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org -fi |