NSLU2-Linux
view · edit · print · history

HowTo.FixTheClockUsingAdjtimexAndNtpclient History

Hide minor edits - Show changes to markup

January 30, 2009, at 11:55 PM by Chong Lee --
Added line 188:

[@

Added lines 190-191:

@] At least for ntpclient version 2007_365-1

January 30, 2009, at 11:50 PM by Chong Lee --
Added lines 185-188:

Chong Lee adds: Or you could use the -q flag: /opt/sbin/adjtimex -q -t 10000

November 01, 2008, at 03:01 AM by Ralph Finch --
Changed lines 6-7 from:

RF: (30Oct2008) The documentation for ntpclient says:

to:

RF: (30Oct2008) The documentation for ntpclient says:

November 01, 2008, at 03:01 AM by Ralph Finch --
Changed line 8 from:
On to ntpclient -l. This is actually easy, if you performed and understood
to:
On to ntpclient -l. This is actually easy, if you performed and understood
November 01, 2008, at 03:01 AM by Ralph Finch --
Changed lines 6-8 from:

RF: (30Oct2008) The documentation for ntpclient says:

   On to ntpclient -l.  This is actually easy, if you performed and understood
to:

RF: (30Oct2008) The documentation for ntpclient says:

On to ntpclient -l. This is actually easy, if you performed and understood
Deleted line 12:
November 01, 2008, at 02:59 AM by Ralph Finch --
Changed line 7 from:

(:linebreaks:)

to:
Changed lines 12-13 from:

(:nolinebreaks:)

to:
November 01, 2008, at 02:59 AM by Ralph Finch --
Changed line 6 from:

RF: (30Oct2008) The documentation for ntpclient says:\\

to:

RF: (30Oct2008) The documentation for ntpclient says: \\\

Changed line 10 from:
     ntpclient -l -h $NTPHOST
to:
     ntpclient -l -h $NTPHOST
November 01, 2008, at 02:58 AM by Ralph Finch --
Changed line 8 from:
On to ntpclient -l. This is actually easy, if you performed and understood
to:
   On to ntpclient -l.  This is actually easy, if you performed and understood
November 01, 2008, at 02:57 AM by Ralph Finch --
November 01, 2008, at 02:57 AM by Ralph Finch --
Changed line 6 from:

RF: (30Oct2008) The documentation for ntpclient says:

to:

RF: (30Oct2008) The documentation for ntpclient says:\\

Changed lines 8-12 from:

On to ntpclient -l. This is actually easy, if you performed and understood the previous steps. Run

  ntpclient -l -h $NTPHOST

in the background.

to:
On to ntpclient -l. This is actually easy, if you performed and understood
   the previous steps.  Run
     ntpclient -l -h $NTPHOST
   in the background.
Added line 13:
November 01, 2008, at 02:55 AM by Ralph Finch --
Changed lines 7-8 from:
to:

(:linebreaks:)

Changed line 13 from:
to:

(:nolinebreaks:)

October 31, 2008, at 10:37 PM by RalphFinch --
Changed line 8 from:

'''@@On to ntpclient -l. This is actually easy, if you performed and understood

to:

On to ntpclient -l. This is actually easy, if you performed and understood

Changed lines 11-13 from:

in the background. @@'''

which to me implies that you must deliberately run ntpclient in the background when using -l.

to:

in the background.

which to me implies that you must deliberately run ntpclient in the background when using -l.

October 31, 2008, at 10:36 PM by RalphFinch --
Changed line 8 from:

@@On to ntpclient -l. This is actually easy, if you performed and understood

to:

'''@@On to ntpclient -l. This is actually easy, if you performed and understood

Changed lines 11-13 from:

in the background. @@

which to me implies that you must deliberately run ntpclient in the background when using -l.

to:

in the background. @@'''

which to me implies that you must deliberately run ntpclient in the background when using -l.

October 31, 2008, at 10:35 PM by RalphFinch --
Added lines 5-13:

RF: (30Oct2008) The documentation for ntpclient says:

@@On to ntpclient -l. This is actually easy, if you performed and understood the previous steps. Run

  ntpclient -l -h $NTPHOST

in the background. @@

which to me implies that you must deliberately run ntpclient in the background when using -l.

September 13, 2008, at 10:00 PM by Gordon Baskin --
Changed line 162 from:
 ****
to:

Changed line 176 from:
 ****
to:

September 13, 2008, at 09:59 PM by Gordon Baskin --
Changed line 171 from:

/opt/sbin/adjtimex -t 10000 >/dev/null

to:

/opt/sbin/adjtimex -t 10000 >/dev/null

Deleted lines 175-179:

In /etc/crontab , delete the line containing hwclock and replace it with the following:

1 * * * * root /opt/bin/ntpclient -s -h pool.ntp.org > /var/log/ntp.log && /usr/sbin/hwclock --systohc --utc
September 13, 2008, at 09:58 PM by Gordon Baskin --
Changed lines 160-181 from:

In Debian, tzconfig

to:

In Debian, tzconfig

 ****

Gordon Baskin adds:

The file /opt/etc/init.d/S10ntpclient could be changed to eliminate the output of adjtimex:

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

In /etc/crontab , delete the line containing hwclock and replace it with the following:

1 * * * * root /opt/bin/ntpclient -s -h pool.ntp.org > /var/log/ntp.log && /usr/sbin/hwclock --systohc --utc
 ****
July 18, 2008, at 08:01 AM by MicRo --
Changed line 3 from:

The -l parameter in the ntpclient command did not work on my NSLU2 (with Unslung 6.10beta) at all. In my case it stopped the NSLU2 boot procedure while executing the /opt/etc/init.d/S10ntpclient script which I found out only as the Ready/Status LED was still blinking after the boot procedure should have finished.

to:

The -l parameter in the ntpclient command does not work in scripts on my NSLU2 (with Unslung 6.10beta) at all. In my case it stopped the NSLU2 boot procedure while executing the /opt/etc/init.d/S10ntpclient script which I found out only because the Ready/Status LED was still blinking after the boot procedure should have finished.

Deleted line 29:
Changed lines 31-32 from:
 chmod +rx /opt/etc/init.d/S10ntpclient /unslung/rc.rstimezone
to:
 chmod +rx /opt/etc/init.d/S10ntpclient
Changed line 42 from:

The -s means to set the clock, -l says to lock the local clock to the server (MicRo: -l does not work on every NSLU2), and -h selects the ntp host.\\

to:

The -s means to set the clock, -h selects the NTP host to get the time from, -l says to lock the local clock to the server (MicRo: -l does not work in scripts because the ntpclient -l command never completes which makes a script using the -l parameter hang!).\\

July 18, 2008, at 07:44 AM by MicRo --
Changed lines 30-57 from:

Create the file /unslung/rc.rstimezone:

#! /bin/sh
# Diversion script to get control of time
#
# Extract the GUI timezone from the .conf file
# Copy the corresponding /usr/zoneinfo file over /usr/local/localtime
/usr/sbin/Set_TimeZone >/dev/null
#
# Adjust the hardware clock for accumulated drift
#
/usr/sbin/hwclock --adjust
#
# Initialize the kernel with the corrected time
#
/usr/sbin/hwclock --hctosys >/dev/null
#
# ntpclient will (shortly) start correcting the system clock
#
# The hwclock drift will be computed & recorded once an hour (crontab)
#
# Do not execute the linksys script
#
return 0
# EOF - include this line

Make /opt/etc/init.d/S10ntpclient and /unslung/rc.rstimezone script executable:

to:

Make /opt/etc/init.d/S10ntpclient script executable:

Changed lines 44-45 from:

Pool.ntp.org is an organization that tries to make it easy for people to find a low-level NTP server that isn't too busy, the idea being to keep from overloading the higher-level servers as some clueless consumer electronics manufacturers have done in the past.

to:

pool.ntp.org is an organization that tries to make it easy for people to find a low-level NTP server that isn't too busy, the idea being to keep from overloading the higher-level servers as some clueless consumer electronics manufacturers have done in the past.

July 17, 2008, at 09:02 AM by MicRo --
Deleted lines 5-10:

Edit Jan08 JW - Below was found to be problematic. Solution was to

  • make sure you have both crond (linksys) and cron running
  • ipkg install ntp
  • ntpdate pool.ntp.org

and that is all if you set cron (/opt/etc/crontab) to ntpdate regularly


July 17, 2008, at 09:00 AM by MicRo --
Changed lines 138-151 from:

/unslung/rc.crond

 #! /bin/sh
 # Diversion script: customize before starting crond
 #
 # Reason: change the periodic update of the hwclock to use --adjust
 #
 if [ ! -e /etc/crontab.orig ]; then cp -p /etc/crontab /etc/crontab.orig; fi
 sed -i -e 's/1 \* \* \* \* root \/usr\/sbin\/hwclock -s \&>\/dev\/null/1 \* \* \* \* root \/usr\/sbin\/hwclock --adjust --utc \&>\/dev\/null/' /etc/crontab
 #
 # Continue to start crond
 #
 return 1
 # EOF - include this line
to:

/unslung/rc.crond

#! /bin/sh
# Diversion script: customize before starting crond
#
# Reason: change the periodic update of the hwclock to use --adjust
#
if [ ! -e /etc/crontab.orig ]; then cp -p /etc/crontab /etc/crontab.orig; fi
sed -i -e 's/1 \* \* \* \* root \/usr\/sbin\/hwclock -s \&>\/dev\/null/1 \* \* \* \* root \/usr\/sbin\/hwclock --adjust --utc \&>\/dev\/null/' /etc/crontab
#
# Continue to start crond
#
return 1
# EOF - include this line
Changed lines 155-187 from:
 SHELL=/bin/sh
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 MAILTO=""
 HOME=/
 # ---------- ---------- Default is Empty ---------- ---------- #
 0 0-23/8 * * * root /usr/sbin/CheckDiskFull &>/dev/null
 0 0 * * * root /usr/sbin/WatchDog? &>/dev/null
 1 * * * * root /usr/sbin/hwclock --adjust --utc &>/dev/null
 **** Don't copy crontab to your system; let the script do the edits ****

/opt/etc/init.d/S10ntpclient

 #!/bin/sh
 #
 if [ -n "`pidof ntpclient`" ]; then
     /bin/killall ntpclient 2>/dev/null
 fi
 #
 # Initialize kernel variables?
 #
 #/opt/sbin/adjtimex -t 10000
 #
 # Simple set first.  This will abruptly ensure that we are in sync with the server
 # if the server responds, we'll set the hwclock to match the response
 #
 /opt/bin/ntpclient -s -l -h 0.pool.ntp.org > /var/log/ntp.log && hwclock --systohc --utc
 #
 # Now start daemon to keep us in sync
 #
 /opt/bin/ntpclient -i 600 -l -h 0.pool.ntp.org >> /var/log/ntp.log & 
 # EOF - include this line

Note: If you extract these scripts, delete the first space on each line -- the wiki gets upset without them, and shell will get upset with them. :-)

to:
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=""
HOME=/
# ---------- ---------- Default is Empty ---------- ---------- #
0 0-23/8 * * * root /usr/sbin/CheckDiskFull &>/dev/null
0 0 * * * root /usr/sbin/WatchDog &>/dev/null
1 * * * * root /usr/sbin/hwclock --adjust --utc &>/dev/null

**** Don't copy crontab to your system; let the script do the edits ****

/opt/etc/init.d/S10ntpclient

#!/bin/sh
#
if [ -n "`pidof ntpclient`" ]; then
    /bin/killall ntpclient 2>/dev/null
fi
#
# Initialize kernel variables?
#
#/opt/sbin/adjtimex -t 10000
#
# Simple set first.  This will abruptly ensure that we are in sync with the server
# if the server responds, we'll set the hwclock to match the response
#
/opt/bin/ntpclient -s -l -h 0.pool.ntp.org > /var/log/ntp.log && hwclock --systohc --utc
#
# Now start daemon to keep us in sync
#
/opt/bin/ntpclient -i 600 -l -h 0.pool.ntp.org >> /var/log/ntp.log & 
# EOF - include this line
July 17, 2008, at 08:54 AM by MicRo --
Changed line 1 from:

Edit July08 MicRo\\

to:

Edit July08 by MicRo\\

Changed line 28 from:

hwclock --systohc --utc

to:

/usr/sbin/hwclock --systohc --utc

Changed line 33 from:

1 * * * * root /opt/bin/ntpclient -s -h pool.ntp.org > /var/log/ntp.log && hwclock --systohc --utc

to:

1 * * * * root /opt/bin/ntpclient -s -h pool.ntp.org > /var/log/ntp.log && /usr/sbin/hwclock --systohc --utc

July 17, 2008, at 08:52 AM by MicRo --
Changed lines 1-3 from:

Edit July08 MicRo?
I took the freedom to edit this page and tried to made it better readable.
The -l parameter in the ntpclient command did not work on my NSLU2 (with Unslung 6.10beta) at all. In my case it stopped the NSLU2 boot procedure while executing the /opt/etc/init.d/S10ntp script which I found out only as the Ready/Status LED was still blinking after the boot procedure should have finished.

to:

Edit July08 MicRo
I took the freedom to edit this page and tried to make it better readable.
The -l parameter in the ntpclient command did not work on my NSLU2 (with Unslung 6.10beta) at all. In my case it stopped the NSLU2 boot procedure while executing the /opt/etc/init.d/S10ntpclient script which I found out only as the Ready/Status LED was still blinking after the boot procedure should have finished.

Changed line 20 from:

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

to:

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

Changed line 33 from:

1 * * * * root /opt/bin/ntpclient -s -h pool.ntp.org >> /var/log/ntp.log && hwclock --systohc --utc

to:

1 * * * * root /opt/bin/ntpclient -s -h pool.ntp.org > /var/log/ntp.log && hwclock --systohc --utc

Changed lines 36-40 from:

Make /opt/etc/init.d/S10ntp script executable:

 chmod +rx /opt/etc/init.d/S10ntp

Run the S10ntp script once by hand, and then it will run automatically every time you reboot.

to:

Create the file /unslung/rc.rstimezone:

#! /bin/sh
# Diversion script to get control of time
#
# Extract the GUI timezone from the .conf file
# Copy the corresponding /usr/zoneinfo file over /usr/local/localtime
/usr/sbin/Set_TimeZone >/dev/null
#
# Adjust the hardware clock for accumulated drift
#
/usr/sbin/hwclock --adjust
#
# Initialize the kernel with the corrected time
#
/usr/sbin/hwclock --hctosys >/dev/null
#
# ntpclient will (shortly) start correcting the system clock
#
# The hwclock drift will be computed & recorded once an hour (crontab)
#
# Do not execute the linksys script
#
return 0
# EOF - include this line

Make /opt/etc/init.d/S10ntpclient and /unslung/rc.rstimezone script executable:

 chmod +rx /opt/etc/init.d/S10ntpclient /unslung/rc.rstimezone

Run the S10ntpclient script once by hand, and then it will run automatically every time you reboot.

Changed line 75 from:

The -s means to set the clock, -l says to lock the local clock to the server (\MicRo?: -l does not work on every NSLU2), and -h selects the ntp host.\\

to:

The -s means to set the clock, -l says to lock the local clock to the server (MicRo: -l does not work on every NSLU2), and -h selects the ntp host.\\

Changed lines 112-113 from:

[@

  1. ! /bin/ash
to:

[@

  1. ! /bin/sh
July 11, 2008, at 01:50 PM by MicRo --
Added line 14:

Install ntpclient:

Changed lines 109-110 from:
to:

@]

July 11, 2008, at 01:46 PM by MicRo --
Added line 18:
Changed line 20 from:

[@

to:

[@

Changed line 35 from:

Make /opt/etc/init.d/S10ntp executable

to:

Make /opt/etc/init.d/S10ntp script executable:

Changed lines 38-39 from:

Run the script once by hand, and then it will run automatically every time you reboot.

to:

Run the S10ntp script once by hand, and then it will run automatically every time you reboot.

Changed lines 83-85 from:

/unslung/rc.rstimezone

 #! /bin/ash
 # Diversion script to get control of time
to:

/unslung/rc.rstimezone

[@

  1. ! /bin/ash
  2. Diversion script to get control of time
  3. Extract the GUI timezone from the .conf file
  4. Copy the corresponding /usr/zoneinfo file over /usr/local/localtime

/usr/sbin/Set_TimeZone >/dev/null

  1. Adjust the hardware clock for accumulated drift

/usr/sbin/hwclock --adjust

  1. Initialize the kernel with the corrected time

/usr/sbin/hwclock --hctosys >/dev/null

  1. ntpclient will (shortly) start correcting the system clock
  2. The hwclock drift will be computed & recorded once an hour (crontab)
  3. Do not execute the linksys script

return 0

  1. EOF - include this line

/unslung/rc.crond

 #! /bin/sh
 # Diversion script: customize before starting crond
Changed lines 113-115 from:
 # Extract the GUI timezone from the .conf file
 # Copy the corresponding /usr/zoneinfo file over /usr/local/localtime
 /usr/sbin/Set_TimeZone >/dev/null
to:
 # Reason: change the periodic update of the hwclock to use --adjust
Changed lines 115-116 from:
 # Adjust the hardware clock for accumulated drift
to:
 if [ ! -e /etc/crontab.orig ]; then cp -p /etc/crontab /etc/crontab.orig; fi
 sed -i -e 's/1 \* \* \* \* root \/usr\/sbin\/hwclock -s \&>\/dev\/null/1 \* \* \* \* root \/usr\/sbin\/hwclock --adjust --utc \&>\/dev\/null/' /etc/crontab
Changed line 118 from:
 /usr/sbin/hwclock --adjust
to:
 # Continue to start crond
Changed lines 120-130 from:
 # Initialize the kernel with the corrected time
 #
 /usr/sbin/hwclock --hctosys >/dev/null
 #
 # ntpclient will (shortly) start correcting the system clock
 #
 # The hwclock drift will be computed & recorded once an hour (crontab)
 #
 # Do not execute the linksys script
 #
 return 0
to:
 return 1
Deleted lines 122-135:

/unslung/rc.crond

 #! /bin/sh
 # Diversion script: customize before starting crond
 #
 # Reason: change the periodic update of the hwclock to use --adjust
 #
 if [ ! -e /etc/crontab.orig ]; then cp -p /etc/crontab /etc/crontab.orig; fi
 sed -i -e 's/1 \* \* \* \* root \/usr\/sbin\/hwclock -s \&>\/dev\/null/1 \* \* \* \* root \/usr\/sbin\/hwclock --adjust --utc \&>\/dev\/null/' /etc/crontab
 #
 # Continue to start crond
 #
 return 1
 # EOF - include this line
July 11, 2008, at 01:41 PM by MicRo --
Changed lines 1-5 from:

Edit July08 \MicRo? I took the freedom to edit this page and tried to made it better readable.

The -l parameter in the ntpclient command did not work on my NSLU2 (with Unslung 6.10beta) at all. In my case it stopped the NSLU2 bootprocedure which I found out as the Ready/Status LED was still blinking after the boot up should have finished. Consequently I removed the -l parameter out of the procedures below.

to:

Edit July08 MicRo?
I took the freedom to edit this page and tried to made it better readable.
The -l parameter in the ntpclient command did not work on my NSLU2 (with Unslung 6.10beta) at all. In my case it stopped the NSLU2 boot procedure while executing the /opt/etc/init.d/S10ntp script which I found out only as the Ready/Status LED was still blinking after the boot procedure should have finished. Consequently I removed the -l parameter out of the scripts below.

Changed lines 12-13 from:

The slug has buggy timekeeping facilities, which Cisco apparently tried to fix, but didn't do a very good job of fixing. As of January 2008, on an Unslung system, bcrowell observed that the clock was set to 1999 by default, and setting it correctly didn't "stick" across reboots. This causes all kinds of problems with file synchronization, unpacking tarballs, etc. The following is a fix for the problem for Unslung 6.8:

to:

The Slug (NSLU2) has buggy timekeeping facilities, which Cisco apparently tried to fix, but didn't do a very good job of fixing. As of January 2008, on an Unslung system, bcrowell observed that the clock was set to 1999 by default, and setting it correctly didn't "stick" across reboots. This causes all kinds of problems with file synchronization, unpacking tarballs, etc. The following is a fix for the problem for Unslung 6.8:

Deleted line 29:
July 11, 2008, at 01:32 PM by MicRo --
Changed line 1 from:

Edit July08 MicRo?

to:

Edit July08 \MicRo?

Changed line 4 from:

I found the -l parameter in the ntpclient command to be problematic. In my case it stopped the NSLU2 bootprocedure which I found out as the Ready/Status LED was still blinking.

to:

The -l parameter in the ntpclient command did not work on my NSLU2 (with Unslung 6.10beta) at all. In my case it stopped the NSLU2 bootprocedure which I found out as the Ready/Status LED was still blinking after the boot up should have finished.

Changed lines 41-42 from:
Explanation:
to:

Explanation:

Changed line 44 from:

The adjtimex line changes the rate at which the system clock runs by 1% relative to the factory default. See the technical explanation at http://www.culcon.com/~henry/nslu2.html.\\

to:

The adjtimex line changes the rate at which the system clock runs by 1% relative to the factory default. See the technical explanation at http://www.culcon.com/~henry/nslu2.html.\\

Changed line 48 from:

The -s means to set the clock, -l says to lock the local clock to the server (MicRo?: does not work on every NSLU2), and -h selects the ntp host.\\

to:

The -s means to set the clock, -l says to lock the local clock to the server (\MicRo?: -l does not work on every NSLU2), and -h selects the ntp host.\\

July 11, 2008, at 01:23 PM by MicRo --
Added lines 1-5:

Edit July08 MicRo? I took the freedom to edit this page and tried to made it better readable.

I found the -l parameter in the ntpclient command to be problematic. In my case it stopped the NSLU2 bootprocedure which I found out as the Ready/Status LED was still blinking. Consequently I removed the -l parameter out of the procedures below.

Changed lines 7-8 from:

Edit Jan08 JW - below was found to be problematic solution was to

to:

Edit Jan08 JW - Below was found to be problematic. Solution was to

Deleted line 12:
Changed lines 41-42 from:

Explanation: (In the following, the xhttp stuff is because a security misfeature in the wiki wouldn't let me add links with http.)

to:
Explanation:
Changed lines 45-51 from:

The adjtimex line changes the rate at which the system clock runs by 1% relative to the factory default. See the technical explanation at http://www.culcon.com/~henry/nslu2.html. There's a man page for adjtimex at http://linuxcommand.org/man_pages/adjtimex8.html .

Documentation for the ntpclient command is available at xhttp://doolittle.icarus.com/ntpclient/ . The -s means to set the clock, -l says to lock the local clock to the server, and -h selects the ntp host. Pool.ntp.org is an organization that tries to make it easy for people to find a low-level ntp server that isn't too busy, the idea being to keep from overloading the higher-level servers as some clueless consumer electronics manufacturers have done in the past.

The crontab sets the clock once per hour, and copies the resulting time to the hardware clock.

to:

The adjtimex line changes the rate at which the system clock runs by 1% relative to the factory default. See the technical explanation at http://www.culcon.com/~henry/nslu2.html.\\ There's a man page for adjtimex at http://linuxcommand.org/man_pages/adjtimex8.html .

Documentation for the ntpclient command is available at http://doolittle.icarus.com/ntpclient/ .
The -s means to set the clock, -l says to lock the local clock to the server (MicRo?: does not work on every NSLU2), and -h selects the ntp host.\\ Pool.ntp.org is an organization that tries to make it easy for people to find a low-level NTP server that isn't too busy, the idea being to keep from overloading the higher-level servers as some clueless consumer electronics manufacturers have done in the past.

The crontab sets the clock once per hour, and copies the resulting time to the hardware clock.

Changed lines 56-59 from:

1. I think ntpclient is normally meant to run continuously in the background. However, this setup seems to run it and then terminate it, starting it again later based on a cron job. This would have the advantage of not taking up memory by having ntpclient always running. Is this correct?

2. The scripts use > rather than >> to write to ntp.log. I assume this is because old ntp log entries are not of interest, and there's no point in gradually using up more and more disk space. Is this correct?

to:
  1. I think ntpclient is normally meant to run continuously in the background. However, this setup seems to run it and then terminate it, starting it again later based on a cron job. This would have the advantage of not taking up memory by having ntpclient always running. Is this correct?
  2. The scripts use > rather than >> to write to ntp.log. I assume this is because old ntp log entries are not of interest, and there's no point in gradually using up more and more disk space. Is this correct?
July 11, 2008, at 01:05 PM by MicRo --
Changed lines 1-3 from:

_______________

edit Jan08 JW - below was found to be problematic

to:

Edit Jan08 JW - below was found to be problematic

Changed lines 4-6 from:

make sure you have both crond (linksys) and cron running ipkg install ntp ntpdate pool.ntp.org

to:
  • make sure you have both crond (linksys) and cron running
  • ipkg install ntp
  • ntpdate pool.ntp.org
Changed lines 8-9 from:

_______________

to:

Changed lines 27-28 from:

In /etc/crontab , DELETE THE HWCLOCK LINE, and replace it with the following:

to:

In /etc/crontab , delete the line containing hwclock and replace it with the following:

Changed lines 32-33 from:

chmod +rx /opt/etc/init.d/S10ntp

to:

Make /opt/etc/init.d/S10ntp executable

 chmod +rx /opt/etc/init.d/S10ntp
Changed lines 42-43 from:

The adjtimex line changes the rate at which the system clock runs by 1% relative to the factory default. See the technical explanation at xhttp://www.culcon.com/~henry/nslu2.html . There's a man page for adjtimex at xhttp://linuxcommand.org/man_pages/adjtimex8.html .

to:

The adjtimex line changes the rate at which the system clock runs by 1% relative to the factory default. See the technical explanation at http://www.culcon.com/~henry/nslu2.html. There's a man page for adjtimex at http://linuxcommand.org/man_pages/adjtimex8.html .

July 11, 2008, at 12:43 PM by MicRo --
Added lines 13-14:

[@

Changed lines 16-17 from:

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

to:

@] Create the file /opt/etc/init.d/S10ntp containing the following:

Changed lines 29-30 from:
    1 * * * * root /opt/bin/ntpclient -s -l -h pool.ntp.org >> /var/log/ntp.log && hwclock --systohc --utc
to:
1 * * * * root /opt/bin/ntpclient -s -h pool.ntp.org >> /var/log/ntp.log && hwclock --systohc --utc
July 11, 2008, at 12:38 PM by MicRo --
Changed lines 16-17 from:

[@

to:

[@

Changed line 22 from:

/opt/bin/ntpclient -s -l -h pool.ntp.org > /var/log/ntp.log

to:

/opt/bin/ntpclient -s -h pool.ntp.org > /var/log/ntp.log

Changed lines 27-28 from:
    1 * * * * root /opt/bin/ntpclient -s -l -h pool.ntp.org > /var/log/ntp.log && hwclock --systohc --utc
to:
    1 * * * * root /opt/bin/ntpclient -s -l -h pool.ntp.org >> /var/log/ntp.log && hwclock --systohc --utc
July 11, 2008, at 12:35 PM by MicRo --
Changed lines 16-23 from:
    #!/bin/sh    
    if [ -n "`pidof ntpclient`" ]; then    
        /bin/killall ntpclient 2>/dev/null    
    fi    
    /opt/sbin/adjtimex -t 10000    
    /opt/bin/ntpclient -s -l -h pool.ntp.org > /var/log/ntp.log
    hwclock --systohc --utc
to:

#!/bin/sh    
if [ -n "`pidof ntpclient`" ]; then    
    /bin/killall ntpclient 2>/dev/null    
fi    
/opt/sbin/adjtimex -t 10000    
/opt/bin/ntpclient -s -l -h pool.ntp.org > /var/log/ntp.log
hwclock --systohc --utc
February 09, 2008, at 02:06 AM by JW -- easier way to update clock
Added lines 1-10:

_______________

edit Jan08 JW - below was found to be problematic solution was to make sure you have both crond (linksys) and cron running ipkg install ntp ntpdate pool.ntp.org and that is all if you set cron (/opt/etc/crontab) to ntpdate regularly _______________

January 16, 2008, at 05:00 AM by tomb --
Changed lines 3-5 from:

Install the ntpclient package

    ipkg install ntpclient
to:

ipkg install ntpclient

January 16, 2008, at 04:59 AM by tomb --
Changed line 3 from:

install the ntpclient package

to:

Install the ntpclient package

January 16, 2008, at 04:59 AM by tomb --
Added lines 3-5:

install the ntpclient package

    ipkg install ntpclient
January 07, 2008, at 06:56 PM by bcrowell --
Changed lines 30-31 from:

The above is an attempt by bcrowell to summarize and organize some previous material. Here are some questions I have at this point. If my understanding of these points is correct, please change them to affirmative statements.

to:

The above is an attempt by me (bcrowell) to summarize and organize some previous material. Here are some questions I have. If my understanding of these points is correct, please change them to affirmative statements.

January 07, 2008, at 06:53 PM by bcrowell --
Added lines 30-35:

The above is an attempt by bcrowell to summarize and organize some previous material. Here are some questions I have at this point. If my understanding of these points is correct, please change them to affirmative statements.

1. I think ntpclient is normally meant to run continuously in the background. However, this setup seems to run it and then terminate it, starting it again later based on a cron job. This would have the advantage of not taking up memory by having ntpclient always running. Is this correct?

2. The scripts use > rather than >> to write to ntp.log. I assume this is because old ntp log entries are not of interest, and there's no point in gradually using up more and more disk space. Is this correct?

January 07, 2008, at 06:49 PM by bcrowell -- delete redundant info
Deleted lines 128-140:
micrilin adding his 5 ct (running nlsu2 on http://nl.atto.nl/)

Why waste your precious memory? I added this line to the crontab:
"1 * * * * root /opt/bin/ntpclient -s -l -h 0.pool.ntp.org > /var/log/ntp.log && hwclock --systohc --utc"
and removed the line "1 * * * * root /usr/sbin/hwclock -s &>/dev/null"
Now our clock gets set every hour (roughly: if there are no errors)

Check /var/log/messages to see if your crond is running okay!


January 07, 2008, at 06:48 PM by bcrowell --
Changed line 12 from:

In /etc/crontab , replace the hwclock line with the following:

to:

In /etc/crontab , DELETE THE HWCLOCK LINE, and replace it with the following:

January 07, 2008, at 06:47 PM by bcrowell --
Added lines 28-29:

The crontab sets the clock once per hour, and copies the resulting time to the hardware clock.

January 07, 2008, at 06:44 PM by bcrowell --
Changed lines 9-11 from:
    /opt/bin/ntpclient -s -h pool.ntp.org > /var/log/ntp.log
    /opt/bin/ntpclient -l -h pool.ntp.org > /var/log/ntp.log &  
to:
    /opt/bin/ntpclient -s -l -h pool.ntp.org > /var/log/ntp.log
    hwclock --systohc --utc

In /etc/crontab , replace the hwclock line with the following:

    1 * * * * root /opt/bin/ntpclient -s -l -h pool.ntp.org > /var/log/ntp.log && hwclock --systohc --utc
Deleted lines 16-17:

Remove the hwclock line from /etc/crontab.

Changed lines 26-29 from:

In the first ntpclient line, -s means to set the clock, and -h selects the ntp host. Pool.ntp.org is an organization that tries to make it easy for people to find a low-level ntp server that isn't too busy, the idea being to keep from overloading the higher-level servers as some clueless consumer electronics manufacturers have done in the past.

In the second ntpclient line, the -l says to lock the local clock to the server, and by default this is done every 10 minutes.

to:

The -s means to set the clock, -l says to lock the local clock to the server, and -h selects the ntp host. Pool.ntp.org is an organization that tries to make it easy for people to find a low-level ntp server that isn't too busy, the idea being to keep from overloading the higher-level servers as some clueless consumer electronics manufacturers have done in the past.

January 07, 2008, at 06:35 PM by bcrowell --
Changed lines 18-19 from:

Explanation:

to:

Explanation: (In the following, the xhttp stuff is because a security misfeature in the wiki wouldn't let me add links with http.)

January 07, 2008, at 06:34 PM by bcrowell --
Changed lines 1-2 from:

The slug has buggy timekeeping facilities, which Cisco says they're going to fix in the future. As of January 2008, on an Unslung system, bcrowell observed that the clock was set to 1999 by default, and setting it correctly didn't "stick" across reboots. This causes all kinds of problems with file synchronization, unpacking tarballs, etc. The following is a fix for the problem for Unslung 6.8:

to:

The slug has buggy timekeeping facilities, which Cisco apparently tried to fix, but didn't do a very good job of fixing. As of January 2008, on an Unslung system, bcrowell observed that the clock was set to 1999 by default, and setting it correctly didn't "stick" across reboots. This causes all kinds of problems with file synchronization, unpacking tarballs, etc. The following is a fix for the problem for Unslung 6.8:

January 07, 2008, at 06:33 PM by bcrowell --
Deleted lines 32-34:

Update The above still does a much better job than the "fix" by Linksys, but if you choose to follow the above instructions, you'll need to edit /etc/crontab to remove the cron task that Linksys added to sync with the hardware clock. NOTE: Remember to remove the hwclock line from /etc/crontab

January 07, 2008, at 06:33 PM by bcrowell --
Added lines 14-15:

Remove the hwclock line from /etc/crontab.

January 07, 2008, at 06:31 PM by bcrowell -- delete redundant info
Deleted lines 30-33:

http://www.culcon.com/~henry/nslu2.html

This page pre-dates the R25 firmware, and so may conflict with the fix that Linksys made. If you have more information on this, please write it here.

Deleted lines 31-47:

Update 2 ntpclient is available as ipkg package: On the NSLU2 run:

    ipkg install ntpclient

This just installs ntpclient. I have also added a startscript: /opt/etc/init.d/S10ntpclient:

    #!/bin/sh

    if [ -n "`pidof ntpclient`" ]; then
        /bin/killall ntpclient 2>/dev/null
    fi

    /opt/sbin/adjtimex -t 10000
    /opt/bin/ntpclient -i 600 -l -h 0.pool.ntp.org > /var/log/ntp.log &
Deleted lines 33-34:

NOTE: http://www.pool.ntp.org/

January 07, 2008, at 06:25 PM by bcrowell --
Added lines 24-26:

In the second ntpclient line, the -l says to lock the local clock to the server, and by default this is done every 10 minutes.

January 07, 2008, at 06:25 PM by bcrowell --
Changed lines 20-23 from:

The adjtimex line changes the rate at which the system clock runs by 1% relative to the factory default. See the technical explanation at xhttp://www.culcon.com/~henry/nslu2.html .

to:

The adjtimex line changes the rate at which the system clock runs by 1% relative to the factory default. See the technical explanation at xhttp://www.culcon.com/~henry/nslu2.html . There's a man page for adjtimex at xhttp://linuxcommand.org/man_pages/adjtimex8.html .

Documentation for the ntpclient command is available at xhttp://doolittle.icarus.com/ntpclient/ . In the first ntpclient line, -s means to set the clock, and -h selects the ntp host. Pool.ntp.org is an organization that tries to make it easy for people to find a low-level ntp server that isn't too busy, the idea being to keep from overloading the higher-level servers as some clueless consumer electronics manufacturers have done in the past.

January 07, 2008, at 06:23 PM by bcrowell --
Changed line 20 from:

The adjtimex line changes the rate at which the system clock runs by 1% relative to the factory default. See the technical explanation at .

to:

The adjtimex line changes the rate at which the system clock runs by 1% relative to the factory default. See the technical explanation at xhttp://www.culcon.com/~henry/nslu2.html .

January 07, 2008, at 06:23 PM by bcrowell --
Changed line 20 from:

The adjtimex line changes the rate at which the system clock runs by 1% relative to the factory default.

to:

The adjtimex line changes the rate at which the system clock runs by 1% relative to the factory default. See the technical explanation at .

January 07, 2008, at 06:22 PM by bcrowell --
Changed line 20 from:
to:

The adjtimex line changes the rate at which the system clock runs by 1% relative to the factory default.

January 07, 2008, at 06:21 PM by bcrowell --
Added lines 18-20:

See http://en.wikipedia.org/wiki/Network_Time_Protocol for an explanation of what NTP is.

January 07, 2008, at 06:21 PM by bcrowell --
Added lines 14-17:

Run the script once by hand, and then it will run automatically every time you reboot.

Explanation:

January 07, 2008, at 06:20 PM by bcrowell --
Added lines 3-15:

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

    #!/bin/sh    
    if [ -n "`pidof ntpclient`" ]; then    
        /bin/killall ntpclient 2>/dev/null    
    fi    
    /opt/sbin/adjtimex -t 10000    
    /opt/bin/ntpclient -s -h pool.ntp.org > /var/log/ntp.log
    /opt/bin/ntpclient -l -h pool.ntp.org > /var/log/ntp.log &  

chmod +rx /opt/etc/init.d/S10ntp


January 07, 2008, at 06:20 PM by bcrowell --
Changed lines 1-2 from:
to:

The slug has buggy timekeeping facilities, which Cisco says they're going to fix in the future. As of January 2008, on an Unslung system, bcrowell observed that the clock was set to 1999 by default, and setting it correctly didn't "stick" across reboots. This causes all kinds of problems with file synchronization, unpacking tarballs, etc. The following is a fix for the problem for Unslung 6.8:

January 07, 2008, at 06:20 PM by bcrowell --
Changed lines 1-6 from:

The slug has buggy timekeeping facilities, which Cisco says they're going to fix in the future. As of January 2008, on an Unslung system, bcrowell observed that the clock was set to 1999 by default, and setting it correctly didn't "stick" across reboots. This causes all kinds of problems with file synchronization, unpacking tarballs, etc. The following is a fix for the

  1. ipkg install ntpclient

See http://en.wikipedia.org/wiki/Network_Time_Protocol for an explanation of what NTP is.

to:
January 07, 2008, at 06:19 PM by bcrowell --
Changed lines 1-2 from:

The slug has buggy timekeeping facilities, which Cisco says they're going to fix in the future. As of January 2008, on an Unslung system, bcrowell observed that the clock was set to 1999 by default, and setting it correctly didn't "stick" across reboots. This causes all kinds of problems with file synchronization, unpacking tarballs, etc. The following is a fix for the problem:

to:

The slug has buggy timekeeping facilities, which Cisco says they're going to fix in the future. As of January 2008, on an Unslung system, bcrowell observed that the clock was set to 1999 by default, and setting it correctly didn't "stick" across reboots. This causes all kinds of problems with file synchronization, unpacking tarballs, etc. The following is a fix for the

January 07, 2008, at 06:18 PM by bcrowell --
Changed lines 1-2 from:

The slug has buggy timekeeping facilities, which Cisco says they're going to fix in the future. As of January 2008, on an Unslung system, bcrowell observed that the clock was set to 1999 by default, and setting it correctly didn't "stick" across reboots. This causes all kinds of problems with file synchronization, unpacking tarballs, etc. The following is a fix for the problem:

to:

The slug has buggy timekeeping facilities, which Cisco says they're going to fix in the future. As of January 2008, on an Unslung system, bcrowell observed that the clock was set to 1999 by default, and setting it correctly didn't "stick" across reboots. This causes all kinds of problems with file synchronization, unpacking tarballs, etc. The following is a fix for the problem:

January 07, 2008, at 06:05 PM by bcrowell --
Added lines 1-6:

The slug has buggy timekeeping facilities, which Cisco says they're going to fix in the future. As of January 2008, on an Unslung system, bcrowell observed that the clock was set to 1999 by default, and setting it correctly didn't "stick" across reboots. This causes all kinds of problems with file synchronization, unpacking tarballs, etc. The following is a fix for the problem:

  1. ipkg install ntpclient

See http://en.wikipedia.org/wiki/Network_Time_Protocol for an explanation of what NTP is.

January 07, 2008, at 06:03 PM by bcrowell --
Changed lines 1-2 from:

NB: This timer problem has now been fixed in the Openslug & UcSlugC source HEAD. test

to:

NB: This timer problem has now been fixed in the Openslug & UcSlugC source HEAD.

January 07, 2008, at 06:03 PM by bcrowell --
Changed lines 1-2 from:

NB: This timer problem has now been fixed in the Openslug & UcSlugC source HEAD.

to:

NB: This timer problem has now been fixed in the Openslug & UcSlugC source HEAD. test

January 07, 2008, at 06:00 PM by Reedy Boy -- rem test
Changed lines 139-141 from:

In Debian, tzconfig

TEST

to:

In Debian, tzconfig

January 07, 2008, at 06:00 PM by Reedy Boy -- TEST
Changed lines 139-141 from:

In Debian, tzconfig

to:

In Debian, tzconfig

TEST

June 17, 2007, at 10:41 AM by 88.107.242.121 -- spelling
Changed lines 132-133 from:

Now our clock gets set every hour (rouhly: if there are no errors)

to:

Now our clock gets set every hour (roughly: if there are no errors)

September 14, 2006, at 01:53 PM by emm_is --
Changed lines 134-139 from:

Check /var/log/messages to see if your crond is running okay!

to:

Check /var/log/messages to see if your crond is running okay!


Don't forget to set your timezone

In Debian, tzconfig

July 29, 2006, at 02:42 PM by cnczane -- point out spelling problem
Changed lines 42-43 from:

Be sure to name and place them exactly as specified. Be sure to delete the leading space from each line. And be sure that you get the very long lines -- without wrapping.

to:

Be sure to name and place them exactly as specified. Be sure to delete the leading space from each line. And be sure that you get the very long lines -- without wrapping. [but note: you've spelled rstimezone two different ways! :^)]

August 07, 2005, at 02:21 PM by blaster8 -- Pointing out the changes made to the timer code in the kernel to fix the clock drift issue
Added lines 1-2:

NB: This timer problem has now been fixed in the Openslug & UcSlugC source HEAD.

August 01, 2005, at 07:35 PM by UncleOp --
Changed line 124 from:

Why waist your precious memory?

to:

Why waste your precious memory?

March 16, 2005, at 10:14 PM by rob --
Changed lines 119-132 from:

Note: If you extract these scripts, delete the first space on each line -- the wiki gets upset without them, and shell will get upset with them. :-)

to:

Note: If you extract these scripts, delete the first space on each line -- the wiki gets upset without them, and shell will get upset with them. :-)


micrilin adding his 5 ct (running nlsu2 on http://nl.atto.nl/)

Why waist your precious memory? I added this line to the crontab:
"1 * * * * root /opt/bin/ntpclient -s -l -h 0.pool.ntp.org > /var/log/ntp.log && hwclock --systohc --utc"
and removed the line "1 * * * * root /usr/sbin/hwclock -s &>/dev/null"
Now our clock gets set every hour (rouhly: if there are no errors)

Check /var/log/messages to see if your crond is running okay!

December 14, 2004, at 11:14 PM by tlhackque --
Changed lines 35-38 from:

The requisite scripts are provided below. It would be nice if the ntpclient kit were updated with these, but I don't have time at the moment..

to:

The requisite scripts are provided below. The diversion script edits, rather than replaces, crontab. This will minimize interactions with other users of crontab.

It would be nice if the ntpclient kit were updated with these, but I don't have time at the moment..

Changed lines 42-43 from:

Update: I changed the diversion script to edit, rather than replace, crontab. This will minimize interactions with other users of crontab.

to:

Also, remember to:

    chmod +x /unslung/rc.rstimezone /unslung/rc.crond /opt/etc/init.d/S10ntpclient
December 13, 2004, at 01:10 PM by tlhackque --
Added lines 37-38:

Be sure to name and place them exactly as specified. Be sure to delete the leading space from each line. And be sure that you get the very long lines -- without wrapping.

Changed line 52 from:
 # Adjust the harware clock for accumulated drift
to:
 # Adjust the hardware clock for accumulated drift
Added line 67:
 # EOF - include this line
Added line 81:
 # EOF - include this line
Changed line 83 from:

/opt/etc/crontab After editing, it will look like this. The original is saved as crontab.orig.

to:

/etc/crontab After editing, it will look like this. The original is saved as crontab.orig.

Added line 92:
 **** Don't copy crontab to your system; let the script do the edits ****
Added line 113:
 # EOF - include this line
December 11, 2004, at 02:06 PM by tman --
Changed line 28 from:

I've done a bit of work on this. Here's a scheme that keeps the hadware clock in-line, gets an accurate time at boot, and runs the client.

to:

I've done a bit of work on this. Here's a scheme that keeps the hardware clock in-line, gets an accurate time at boot, and runs the client.

December 09, 2004, at 01:43 AM by tlhackque --
Changed line 31 from:
  • When crond initializes, we replace crontab with the copy in /opt/etc to get the hourly updates
to:
  • When crond initializes, we edit /etc/crontab to get the hourly updates
Changed lines 35-37 from:

The requisite scripts are provided below. it would be nice if the ntpclient kit were updated with these, but I don't have time at the moment..

to:

The requisite scripts are provided below. It would be nice if the ntpclient kit were updated with these, but I don't have time at the moment..

Update: I changed the diversion script to edit, rather than replace, crontab. This will minimize interactions with other users of crontab.

Changed line 68 from:
 # Diversion script: replace crontab with customized one before starting crond
to:
 # Diversion script: customize before starting crond
Changed lines 72-73 from:
 if [ -e /opt/etc/crontab ]; then cp -fp /opt/etc/crontab /etc/crontab; fi
to:
 if [ ! -e /etc/crontab.orig ]; then cp -p /etc/crontab /etc/crontab.orig; fi
 sed -i -e 's/1 \* \* \* \* root \/usr\/sbin\/hwclock -s \&>\/dev\/null/1 \* \* \* \* root \/usr\/sbin\/hwclock --adjust --utc \&>\/dev\/null/' /etc/crontab
Deleted line 77:

Note: You can't use a symbolic link; crond gets very upset!

Changed line 79 from:

/opt/etc/crontab

to:

/opt/etc/crontab After editing, it will look like this. The original is saved as crontab.orig.

December 06, 2004, at 12:48 AM by tlhackque --
Changed lines 25-107 from:

NOTE: http://www.pool.ntp.org/

to:

NOTE: http://www.pool.ntp.org/


I've done a bit of work on this. Here's a scheme that keeps the hadware clock in-line, gets an accurate time at boot, and runs the client.

  • Early in boot, rc.rsttimezone initializes the timezone, calibrates the hardware clock, and sets the initial time.
  • When crond initializes, we replace crontab with the copy in /opt/etc to get the hourly updates
  • When the network comes up, S10ntpclient gets the network time, sets the system time, and starts the daemon.
  • From then on, the client keeps the system time accurate, and the crond job keeps the hardware clock accurate.

The requisite scripts are provided below. it would be nice if the ntpclient kit were updated with these, but I don't have time at the moment..

Enjoy,

    --tlhackque

/unslung/rc.rstimezone

 #! /bin/ash
 # Diversion script to get control of time
 #
 # Extract the GUI timezone from the .conf file
 # Copy the corresponding /usr/zoneinfo file over /usr/local/localtime
 /usr/sbin/Set_TimeZone >/dev/null
 #
 # Adjust the harware clock for accumulated drift
 #
 /usr/sbin/hwclock --adjust
 #
 # Initialize the kernel with the corrected time
 #
 /usr/sbin/hwclock --hctosys >/dev/null
 #
 # ntpclient will (shortly) start correcting the system clock
 #
 # The hwclock drift will be computed & recorded once an hour (crontab)
 #
 # Do not execute the linksys script
 #
 return 0

/unslung/rc.crond

 #! /bin/sh
 # Diversion script: replace crontab with customized one before starting crond
 #
 # Reason: change the periodic update of the hwclock to use --adjust
 #
 if [ -e /opt/etc/crontab ]; then cp -fp /opt/etc/crontab /etc/crontab; fi
 #
 # Continue to start crond
 #
 return 1

Note: You can't use a symbolic link; crond gets very upset!

/opt/etc/crontab

 SHELL=/bin/sh
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 MAILTO=""
 HOME=/
 # ---------- ---------- Default is Empty ---------- ---------- #
 0 0-23/8 * * * root /usr/sbin/CheckDiskFull &>/dev/null
 0 0 * * * root /usr/sbin/WatchDog? &>/dev/null
 1 * * * * root /usr/sbin/hwclock --adjust --utc &>/dev/null

/opt/etc/init.d/S10ntpclient

 #!/bin/sh
 #
 if [ -n "`pidof ntpclient`" ]; then
     /bin/killall ntpclient 2>/dev/null
 fi
 #
 # Initialize kernel variables?
 #
 #/opt/sbin/adjtimex -t 10000
 #
 # Simple set first.  This will abruptly ensure that we are in sync with the server
 # if the server responds, we'll set the hwclock to match the response
 #
 /opt/bin/ntpclient -s -l -h 0.pool.ntp.org > /var/log/ntp.log && hwclock --systohc --utc
 #
 # Now start daemon to keep us in sync
 #
 /opt/bin/ntpclient -i 600 -l -h 0.pool.ntp.org >> /var/log/ntp.log & 

Note: If you extract these scripts, delete the first space on each line -- the wiki gets upset without them, and shell will get upset with them. :-)

November 26, 2004, at 02:01 PM by perlguru --
Changed line 20 from:
    /opt/bin/adjtimex -t 10000
to:
    /opt/sbin/adjtimex -t 10000
November 26, 2004, at 12:52 PM by perlguru --
Changed lines 5-25 from:

Update The above still does a much better job than the "fix" by Linksys, but if you choose to follow the above instructions, you'll need to edit /etc/crontab to remove the cron task that Linksys added to sync with the hardware clock.

to:

Update The above still does a much better job than the "fix" by Linksys, but if you choose to follow the above instructions, you'll need to edit /etc/crontab to remove the cron task that Linksys added to sync with the hardware clock.

Update 2 ntpclient is available as ipkg package: On the NSLU2 run:

    ipkg install ntpclient

This just installs ntpclient. I have also added a startscript: /opt/etc/init.d/S10ntpclient:

    #!/bin/sh

    if [ -n "`pidof ntpclient`" ]; then
        /bin/killall ntpclient 2>/dev/null
    fi

    /opt/bin/adjtimex -t 10000
    /opt/bin/ntpclient -i 600 -l -h 0.pool.ntp.org > /var/log/ntp.log &

NOTE: Remember to remove the hwclock line from /etc/crontab

NOTE: http://www.pool.ntp.org/

October 02, 2004, at 07:26 PM by jbuzbee --
Changed lines 3-5 from:

This page pre-dates the R25 firmware, and so may conflict with the fix that Linksys made. If you have more information on this, please write it here.

to:

This page pre-dates the R25 firmware, and so may conflict with the fix that Linksys made. If you have more information on this, please write it here.

Update The above still does a much better job than the "fix" by Linksys, but if you choose to follow the above instructions, you'll need to edit /etc/crontab to remove the cron task that Linksys added to sync with the hardware clock.

September 13, 2004, at 06:25 AM by rwhitby --
Changed lines 1-3 from:
to:

http://www.culcon.com/~henry/nslu2.html

This page pre-dates the R25 firmware, and so may conflict with the fix that Linksys made. If you have more information on this, please write it here.

view · edit · print · history · Last edited by Chong Lee.
Based on work by Chong Lee, Ralph Finch, RalphFinch, Gordon Baskin, MicRo, JW, tomb, bcrowell, Reedy Boy, an anonymous user of NSLU2-Linux, emm_is, cnczane, blaster8, UncleOp, rob, tlhackque, tman, perlguru, and jbuzbee.
Originally by rwhitby.
Page last modified on January 30, 2009, at 11:55 PM