view · edit · print · history

Install the software needed to be an ntpclient:

ipkg install ntpclient
ipkg install ntp-utils
ipkg install ntp-tickadj

If not already installed, also install the killall package. Note that this installs killall under /usr/bin instead of /bin, so change the path accordingly in the following script.

Create the file /opt/etc/init.d/slugclock containing the following:

if [ -n "`pidof ntpclient`" ]; then
    /bin/killall ntpclient 2>/dev/null
/sbin/adjtimex -t 10000
/sbin/ntpclient -s -h pool.ntp.org > /var/log/ntp.log
/sbin/hwclock --systohc --utc

You may need to change priviledges on the file

chmod 0755 /opt/etc/init.d/slugclock

You can determine your normal operating runlevel that should be 3:


You may need to copy above created file to /etc/init.d

cp /opt/etc/init.d/slugclock /etc/init.d/slugclock

On the directory /etc/rc#.d where # is the runlevel (/etc/rc3.d normally), link the script to be executed once at boot time:

ln -s /etc/init.d/slugclock S99slugclock

Install the cron daemon:

ipkg install cron

If ipkg complains that cron is already installed by busybox, force installation

ipkg -force-overwrite install cron

And make sure that the clock is syncronized at least once an hour by editing the crontab as the user root with the following command:

crontab -e

Add the following line and save.

0 * * * * /etc/init.d/slugclock

Run clock adjustment.


Check if log file was created (if not, you have some problems).

ls -la /var/log/ntp.log

If file was created, but is empty, possibly time difference is too big to be corrected by ntp. In such a case first use the manual time adjustment with time close to the correct one (substitute hh:mm with current hour/minutes - e.g., 14:25).

date -s hh:mm

More information can be found here: FixTheClockUsingAdjtimexAndNtpclient

view · edit · print · history · Last edited by Koen Rousseau.
Based on work by jacek and thx1011.
Originally by thx1011.
Page last modified on October 18, 2009, at 10:00 AM