16.7 NTPdate

If you only have irregular access to the Internet then ntpdate is useful. The package provides the ntpdate command to query an NTP server and to update your clock. You can do this manually as you see fit with:

  $ ntpdate ntp.togaware.com

The advantage is that you will not have regular net transmissions as with the NTP server. This could save you up to 4MB per day. This could also be done as a cron job, for example.

For irregular access through a modem using PPP though, a good idea is to create a script file in /etc/ppp/ip-up.d called ntpdate containing:

#!/bin/sh

#invoke ntpdate to set time from system clock
if [ -x /usr/sbin/ntpdate ]; then
        /usr/sbin/ntpdate -s -t 5 ntp.togaware.com
        /sbin/hwclock --systohc
fi

Make sure the script is executable:

  # chmod a+rx /etc/ppp/ip-up.d/ntpdate

Then each time you connect the local clock will be synchronised with the NTP server.



Your donation will support ongoing availability and give you access to the PDF version of the book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.