ntpdate

By default Ubuntu’s NTP date configuration is not very dynamic, I have attempted to improve this. Below I have posted a copy of each of my changed files, you may not approve of some changes and discard them or modify them to suite your needs. I would suggest you modify the ‘uk’ in the list of NTP servers, you can use the pool.ntp.org website to find out what servers are available in your country and how to use the pool.

/etc/default/ntpdate

# servers to check.   (Separate multiple servers with spaces.)
NTPSERVERS="0.uk.pool.ntp.org 1.uk.pool.ntp.org 2.uk.pool.ntp.org"

# Default Ubuntu NTP Server
# NTPSERVERS="ntp.ubuntulinux.org"
#
# additional options for ntpdate
#NTPOPTIONS="-v"
NTPOPTIONS="-u"

/etc/cron.hourly/ntpdate

#!/bin/sh

PATH=/sbin:/bin

test -f /usr/sbin/ntpdate || exit 0

if test -f /etc/default/ntpdate ; then
        . /etc/default/ntpdate
else
        NTPSERVERS="pool.ntp.org"
fi

test -n "$NTPSERVERS" || exit 0

/usr/sbin/ntpdate -s $NTPOPTIONS $NTPSERVERS >> /dev/null 2>&1

# Exit with a succes anyway, avoids spamming root.
exit 0

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>