NSLU2-Linux
view · edit · print · history

Optware.Ntpclient History

Hide minor edits - Show changes to markup

September 01, 2008, at 12:40 AM by Marco -- url edit
Changed line 115 from:

Google brought me to the possible cause of the problem (via http://www.nslu2-info.de/showthread.php?t=4264, German site): the battery might not make contact.

to:

Google brought me to the possible cause of the problem (via http://www.nslu2-info.de/forum/showthread.php?t=4264, German site): the battery might not make contact.

February 14, 2008, at 10:15 PM by avgjoe --
Changed lines 116-120 from:

Solution: Open the NSLU2 case and bend the metal strips under the battery a little. After that everything worked fine with me.

to:

Solution: Open the NSLU2 case and bend the metal strips under the battery a little. After that everything worked fine with me.


Solution posted above worked for me. I had my slug open to de-underclock it and saw that the battery was not firmly in place. After pressing it tightly and bending the metal strips a bit, it worked fine. My slug is keeping time after reboots and I can sync the time with /usr/sbin/hwclock --systohc

October 24, 2007, at 08:00 AM by Darek --
Changed lines 98-99 from:

NOTE: see article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

to:

NOTE: see Debug Crontab Problems article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

October 24, 2007, at 07:57 AM by Darek --
Changed lines 98-99 from:

NOTE: see article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

to:

NOTE: see article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

October 24, 2007, at 07:57 AM by Darek --
Changed lines 98-99 from:

NOTE: see HowTo:Debug Crontab Problems? article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

to:

NOTE: see article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

October 24, 2007, at 07:56 AM by Darek --
Changed lines 98-99 from:

NOTE: see DebugCrontabProblems? article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

to:

NOTE: see HowTo:Debug Crontab Problems? article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

October 24, 2007, at 07:55 AM by Darek --
Changed lines 98-99 from:

NOTE: see HowTo:DebugCrontabProblems? article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

to:

NOTE: see DebugCrontabProblems? article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

October 24, 2007, at 07:54 AM by Darek --
Changed lines 98-99 from:

NOTE: see HowTo:SeeDebugCrontabProblems? article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

to:

NOTE: see HowTo:DebugCrontabProblems? article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

October 24, 2007, at 07:52 AM by Darek --
Changed lines 98-99 from:

NOTE: see SeeDebugCrontabProblems? article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

to:

NOTE: see HowTo:SeeDebugCrontabProblems? article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

October 24, 2007, at 07:49 AM by Darek --
Changed lines 98-99 from:

NOTE: see SeeDebugCrontabProblems? article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

to:

NOTE: see SeeDebugCrontabProblems? article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

October 24, 2007, at 04:54 AM by Darek --
Changed lines 94-95 from:

The current package (as of January 2006 and firmware 5.5-beta) installs /opt/etc/cron.d/ntpclient which does the hourly ntp update. All that you need to do then is add a redirect script to set the time at boot and use the following modified cron line for hwclock:

to:

The current package (as of January 2006 and firmware 5.5-beta) installs /opt/etc/cron.d/ntpclient which does the hourly ntp update. All that you need to do then is add a redirect script to set the time at boot and use the following modified cron line for hwclock:

Added lines 98-99:

NOTE: see SeeDebugCrontabProblems? article to read more on crond and cron. You MUST install cron ipkg package in order for ntpclient to work properly.

December 27, 2006, at 08:30 PM by Julius -- the -> that
Changed line 110 from:

I discovered the when I executed the /usr/sbin/hwclock --systohc command, I still got the message:

to:

I discovered that when I executed the /usr/sbin/hwclock --systohc command, I still got the message:

December 27, 2006, at 08:25 PM by Julius -- Remove wrong assumption on crontab file. Re-edit battery problem text
Deleted lines 109-112:

The current package (as of December 2006 and firmware 6.8-beta) installs /opt/etc/cron.d/ntpclient which does the hourly ntp update. However the Optware cron will only look in /etc/crontab (see, for example, man cron), so put the lines of the cron.d/ntpclient into the /etc/crontab file and add the hwclock line (see above) also to it.

For startup use the rc.rstimezone script as mentioned above.

Changed lines 113-116 from:

Google brought me to the solution (German site, so I will translate):

  http://www.nslu2-info.de/showthread.php?t=4264

The solution, for me as for Björn, was to open the NSLU2 case and bend the metal strips under the battery a little. After that everything worked fine with me.

to:

Google brought me to the possible cause of the problem (via http://www.nslu2-info.de/showthread.php?t=4264, German site): the battery might not make contact. Solution: Open the NSLU2 case and bend the metal strips under the battery a little. After that everything worked fine with me.

December 25, 2006, at 11:55 PM by Julius -- Minor text change
Changed lines 110-111 from:

The current package (as of December 2006 and firmware 6.8-beta) installs /opt/etc/cron.d/ntpclient which does the hourly ntp update. However the Optware cron will only look in /etc/crontab (see for example man cron), so put the lines of the cron.d/ntpclient into the /etc/crontab file and add the hwclock line (see above) also to it.

to:

The current package (as of December 2006 and firmware 6.8-beta) installs /opt/etc/cron.d/ntpclient which does the hourly ntp update. However the Optware cron will only look in /etc/crontab (see, for example, man cron), so put the lines of the cron.d/ntpclient into the /etc/crontab file and add the hwclock line (see above) also to it.

December 25, 2006, at 11:54 PM by Julius -- NLSU2 -> NSLU2
Changed line 120 from:

The solution, for me as for Björn, was to open the NLSU2? case and bend the metal strips under the battery a little. After that everything worked fine with me.

to:

The solution, for me as for Björn, was to open the NSLU2 case and bend the metal strips under the battery a little. After that everything worked fine with me.

December 25, 2006, at 11:51 PM by Julius -- Minor text changes
Changed lines 110-113 from:

The current package (as of December 2006 and firmware 6.8-beta) installs /opt/etc/cron.d/ntpclient which does the hourly ntp update. However the Optware cron will only look in /etc/crontab, so put the lines in de cron.d/ntpclient into the /etc/crontab file and at the hwclock lines as follows:

  22 * * * * root /usr/sbin/hwclock --systohc &>/dev/null
to:

The current package (as of December 2006 and firmware 6.8-beta) installs /opt/etc/cron.d/ntpclient which does the hourly ntp update. However the Optware cron will only look in /etc/crontab (see for example man cron), so put the lines of the cron.d/ntpclient into the /etc/crontab file and add the hwclock line (see above) also to it.

Changed line 114 from:

I discovered the when I executed the /usr/sbin/hwclock command, I still got a message:

to:

I discovered the when I executed the /usr/sbin/hwclock --systohc command, I still got the message:

December 25, 2006, at 11:48 PM by Julius -- cron redirect and battery problem
Added lines 107-122:

The current package (as of December 2006 and firmware 6.8-beta) installs /opt/etc/cron.d/ntpclient which does the hourly ntp update. However the Optware cron will only look in /etc/crontab, so put the lines in de cron.d/ntpclient into the /etc/crontab file and at the hwclock lines as follows:

  22 * * * * root /usr/sbin/hwclock --systohc &>/dev/null

For startup use the rc.rstimezone script as mentioned above.

I discovered the when I executed the /usr/sbin/hwclock command, I still got a message:

  Timed out waiting for time change.

Google brought me to the solution (German site, so I will translate):

  http://www.nslu2-info.de/showthread.php?t=4264

The solution, for me as for Björn, was to open the NLSU2? case and bend the metal strips under the battery a little. After that everything worked fine with me.

June 11, 2006, at 05:31 PM by Rob Lockhart -- misspellings
Changed line 28 from:
 # The lines below are probably a restitute of a user of an additionle irrelevant (metalog) package 
to:
 # The lines below are probably a restitute of a user of an additional irrelevant (metalog) package 
Changed line 33 from:
 # We assume that syslogd has alreade been disabled in /etc/inittab
to:
 # We assume that syslogd has already been disabled in /etc/inittab
June 11, 2006, at 05:28 PM by Rob Lockhart -- typos
Changed lines 70-72 from:

You should also note that this is script, which runs only on startup so sets clock only once. If your NSLU2 runs all the time clock will have time difference (about 20 minutes after 1 day). So you should think about NTP server or running ntp client much more frequently if you want to have correct time on NSLU2. The examplescript now includes a clockdrift fix, which can be enabled by removing, the '#' before the /opt/sbin/adjtimex -t 10000. Clock shoul keep time rather well when enabled. It is commented out, because Linksys might fix iot in a newer version, then it will be only usefull for the legacy users among us.

to:

You should also note that this is script, which runs only on startup so sets clock only once. If your NSLU2 runs all the time clock will have time difference (about 20 minutes after 1 day). So you should think about NTP server or running ntp client much more frequently if you want to have correct time on NSLU2. The example script now includes a clockdrift fix, which can be enabled by removing, the '#' before the /opt/sbin/adjtimex -t 10000. Clock should keep time rather well when enabled. It is commented out, because Linksys might fix it in a newer version, then it will be only usefull for the legacy users among us.

January 25, 2006, at 01:21 PM by Mark --
Changed lines 28-29 from:
 # The lines below are probably a restitute of a user of an additionle irrelevant (metealog) package 
to:
 # The lines below are probably a restitute of a user of an additionle irrelevant (metalog) package 
January 25, 2006, at 01:20 PM by Mark --
Added lines 29-31:
 # The lines below are probably a restitute of a user of an additionle irrelevant (metealog) package 
 # They can be left commented out.
 # These line are irrelevant for the ntpscript.
Added lines 36-41:
 # /opt/sbin/metalog --daemonize 
 #
 # Diversion script: customize before starting crond 
 #
 # Reason, update the clock from a timeserver and when needed correct the clockdrift 
 #
Changed lines 48-49 from:
 /opt/sbin/metalog --daemonize
to:
Changed lines 57-60 from:
 return 0
to:
 #
 # Continue to start crond
 return 1
 # EOF - include this line
January 25, 2006, at 01:08 PM by Mark -- Minor clockfix
Added lines 32-38:
 #
 # To prevent the clockdrift on the unslungfirmware 5.5 or lower enable the last comment line below,  
 # by removeing the '#' before "/opt/sbin/adjtimex -t 10000". 
 # This command set the clockdrift to the linux standard value of 10.000
 # When this command is added the clockdrift should be minimized, 
 # so you can choose to execute less time synchronisations
 # /opt/sbin/adjtimex -t 10000
Changed lines 60-61 from:

You should also note that this is script, which runs only on startup so sets clock only once. If your NSLU2 runs all the time clock will have time difference (about 20 minutes after 1 day). So you should think about NTP server or running ntp client much more frequently if you want to have correct time on NSLU2.

to:

You should also note that this is script, which runs only on startup so sets clock only once. If your NSLU2 runs all the time clock will have time difference (about 20 minutes after 1 day). So you should think about NTP server or running ntp client much more frequently if you want to have correct time on NSLU2. The examplescript now includes a clockdrift fix, which can be enabled by removing, the '#' before the /opt/sbin/adjtimex -t 10000. Clock shoul keep time rather well when enabled. It is commented out, because Linksys might fix iot in a newer version, then it will be only usefull for the legacy users among us.

Added lines 70-72:

Mark: I don't have it in my script, it is probly a system utility like a better loging deamon. I think it should be removed from the example.

January 22, 2006, at 09:37 AM by VivekKhera -- current package installs cron script for you
Changed lines 68-85 from:

Simon

to:

Simon


The current package (as of January 2006 and firmware 5.5-beta) installs /opt/etc/cron.d/ntpclient which does the hourly ntp update. All that you need to do then is add a redirect script to set the time at boot and use the following modified cron line for hwclock:

  22 * * * * root /usr/sbin/hwclock --systohc &>/dev/null

Here's my /unslung/rc.rstimezone script:

 #!/bin/sh
 /usr/sbin/Set_TimeZone >/dev/null
 if [ -x /opt/bin/ntpclient ]; then
        /opt/bin/ntpclient -h pool.ntp.org -s >/dev/null
        /usr/sbin/hwclock --systohc >/dev/null 
 fi
 return 0
August 15, 2005, at 05:59 PM by Simon Budig -- Cronlines for NTP
Changed lines 57-68 from:
  - aka, use cron. -Sharth
to:
  - aka, use cron. -Sharth

What is the thing with this metalog stuff? What is it, and how is it related to ntp? Here are my cron lines to synchronize the time. Note that I disabled the default hwclock line.

  #1 * * * * root /usr/sbin/hwclock -s &>/dev/null
  11 * * * * root /opt/bin/ntpclient -h pool.ntp.org -s &>/dev/null
  12 * * * * root /usr/sbin/hwclock --systohc &>/dev/null

Simon

August 13, 2005, at 08:44 PM by Sharth --
Changed lines 55-57 from:
to:

BiG?

  - aka, use cron. -Sharth
July 02, 2005, at 11:01 PM by BiG --
Changed lines 53-72 from:

You should also note that this is script, which runs only on startup so sets clock only once. If your NSLU2 runs all the time clock will have time difference (about few minutes after 1 day). So you should think about NTP server or running ntp client much more frequently (check -c and -i parameters) if you want to have correct time on NSLU2.

So if you want permanently good time use something like this (according to http://doolittle.faludi.com/ntpclient/HOWTO ):

(:table border=0 width=100% bgcolor=#eeffee:) (:cell:)

 #!/bin/sh

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

 if [ -x /opt/bin/ntpclient ]; then
         /opt/bin/ntpclient -h pool.ntp.org -s >/dev/null
         /usr/sbin/hwclock --systohc >/dev/null
         /opt/bin/ntpclient -l -c 0 -h pool.ntp.org >/dev/null &
 fi

 return 0

(:tableend:)

to:

You should also note that this is script, which runs only on startup so sets clock only once. If your NSLU2 runs all the time clock will have time difference (about 20 minutes after 1 day). So you should think about NTP server or running ntp client much more frequently if you want to have correct time on NSLU2.

July 02, 2005, at 10:14 AM by BiG -- I've added one missing "-" in "--hctosys" option to hwclock in script above and some remarks about running ntpclient all the time to keep correct time.
Changed lines 35-36 from:
 /usr/sbin/hwclock -hctosys >/dev/null
to:
 /usr/sbin/hwclock --hctosys >/dev/null
Changed lines 48-73 from:
  • Note: `hwclock -s` is equivalent to `hwclock --hctosys`, which would force the hardware level clock to override (write out to) the system (OS) level clock. More useful would be `hwclock -w` which is equivalent to `hwclock --systohc`, which forces the system (OS) level clock to override (write out to) the hardware level clock.
to:
  • Note: `hwclock -s` is equivalent to `hwclock --hctosys`, which would force the hardware level clock to override (write out to) the system (OS) level clock. More useful would be `hwclock -w` which is equivalent to `hwclock --systohc`, which forces the system (OS) level clock to override (write out to) the hardware level clock.

___________

I've added one missing "-" in "--hctosys" option to hwclock in script above.

You should also note that this is script, which runs only on startup so sets clock only once. If your NSLU2 runs all the time clock will have time difference (about few minutes after 1 day). So you should think about NTP server or running ntp client much more frequently (check -c and -i parameters) if you want to have correct time on NSLU2.

So if you want permanently good time use something like this (according to http://doolittle.faludi.com/ntpclient/HOWTO ):

(:table border=0 width=100% bgcolor=#eeffee:) (:cell:)

 #!/bin/sh

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

 if [ -x /opt/bin/ntpclient ]; then
         /opt/bin/ntpclient -h pool.ntp.org -s >/dev/null
         /usr/sbin/hwclock --systohc >/dev/null
         /opt/bin/ntpclient -l -c 0 -h pool.ntp.org >/dev/null &
 fi

 return 0

(:tableend:)

BiG?

February 17, 2005, at 12:16 AM by bobtm --
Changed line 23 from:

The above setup is broken since it overwrites the system time set by ntpclient when executing hwclock -s. The flow of the script should be that if ntpclient is present, fetch system time using NTP and then store the updated system time to the hardware clock. If the NTP lookup fails, we must be sure that we don't store 1.1.1970 00:00 which is the default system time) to the hardware clock, so prior to calling ntpclient, we set the system time to the hardware clock.

to:

The above setup is broken since it overwrites the system time set by ntpclient when executing hwclock -s. The flow of the script should be that if ntpclient is present, fetch system time using NTP and then store the updated system time to the hardware clock. If the NTP lookup fails, we must be sure that we don't store 1.1.1970 00:00 (which is the default system time) to the hardware clock, so prior to calling ntpclient, we set the system time to the hardware clock.

February 16, 2005, at 10:29 PM by bobtm --
Changed line 21 from:

This did not work for me. The ntpclient fetched the correct time and set the system date accordingly, but the "hwclock -s" command reset it (the "-s" option is not described in the "hwclock --help" printout, so God knows what it does). What works for me is to set the hw clock to the system date after ntpclient has set it correctly, like this:

to:

Update

Added lines 23-26:

The above setup is broken since it overwrites the system time set by ntpclient when executing hwclock -s. The flow of the script should be that if ntpclient is present, fetch system time using NTP and then store the updated system time to the hardware clock. If the NTP lookup fails, we must be sure that we don't store 1.1.1970 00:00 which is the default system time) to the hardware clock, so prior to calling ntpclient, we set the system time to the hardware clock.

table border=0 width=100% bgcolor=#eeffee? cell?

Added lines 29-33:
 # Time to start metalog - can't start it much sooner as rc.bootbin
 # unmounts and mounts things
 # We assume that syslogd has alreade been disabled in /etc/inittab
 /opt/sbin/metalog --daemonize
Added line 35:
 /usr/sbin/hwclock -hctosys >/dev/null
Changed lines 39-42 from:
        /usr/sbin/hwclock --systohc >/dev/null
 else
        /usr/sbin/hwclock
        /usr/sbin/hwclock -s >/dev/null
to:
        /usr/sbin/hwclock --systohc >/dev/null 
Added lines 43-44:
February 09, 2005, at 01:56 AM by anonymous --
Added lines 38-39:
  • Note: `hwclock -s` is equivalent to `hwclock --hctosys`, which would force the hardware level clock to override (write out to) the system (OS) level clock. More useful would be `hwclock -w` which is equivalent to `hwclock --systohc`, which forces the system (OS) level clock to override (write out to) the hardware level clock.
January 31, 2005, at 06:53 PM by ju55i --
Changed line 29 from:
        /usr/sbin/hwclock -systohc >/dev/null
to:
        /usr/sbin/hwclock --systohc >/dev/null
January 29, 2005, at 07:41 PM by bobtm --
Changed line 21 from:

This did not work for me. The ntpclient fetched the correct time and set the system date accordingly, but the "hwclock -s" command reset it. What works for me is to set the hw clock to the system date after ntpclient has set it correctly, like this:

to:

This did not work for me. The ntpclient fetched the correct time and set the system date accordingly, but the "hwclock -s" command reset it (the "-s" option is not described in the "hwclock --help" printout, so God knows what it does). What works for me is to set the hw clock to the system date after ntpclient has set it correctly, like this:

January 29, 2005, at 07:32 PM by bobtm --
Changed lines 17-37 from:

I also changed the hwclock entry in /etc/crontab into a ntpclient entry, and used the resling script to save my changes.

to:

I also changed the hwclock entry in /etc/crontab into a ntpclient entry, and used the resling script to save my changes.


This did not work for me. The ntpclient fetched the correct time and set the system date accordingly, but the "hwclock -s" command reset it. What works for me is to set the hw clock to the system date after ntpclient has set it correctly, like this:

 #!/bin/sh

 /usr/sbin/Set_TimeZone >/dev/null

 if [ -x /opt/bin/ntpclient ]; then
        /opt/bin/ntpclient -h pool.ntp.org -s >/dev/null
        /usr/sbin/hwclock -systohc >/dev/null
 else
        /usr/sbin/hwclock
        /usr/sbin/hwclock -s >/dev/null
 fi

 return 0

bob(tm)

January 06, 2005, at 09:02 PM by rwhitby --
Changed lines 17-25 from:

I also changed the hwclock entry in /etc/crontab into a ntpclient entry, and used the flashfs script to save it, and then reload that on each boot using the following /unslung/rc.local diversion script:

 #!/bin/sh

 if [ -f /share/flash/data/flashfs.tar.gz ]; then
        /sbin/flashfs load
 fi

 return 1
to:

I also changed the hwclock entry in /etc/crontab into a ntpclient entry, and used the resling script to save my changes.

December 20, 2004, at 01:52 AM by scott --
Changed line 5 from:
 /usr/sbin/Set_TimeZone &>/dev/null
to:
 /usr/sbin/Set_TimeZone >/dev/null
Changed lines 8-9 from:
        /opt/bin/ntpclient -h pool.ntp.org -s &>/dev/null
        /usr/sbin/hwclock -s &>/dev/null
to:
        /opt/bin/ntpclient -h pool.ntp.org -s >/dev/null
        /usr/sbin/hwclock -s >/dev/null
Changed line 12 from:
        /usr/sbin/hwclock -s &>/dev/null
to:
        /usr/sbin/hwclock -s >/dev/null
December 07, 2004, at 10:49 AM by scott --
Changed line 5 from:
 /usr/sbin/Set_TimeZone >/dev/null
to:
 /usr/sbin/Set_TimeZone &>/dev/null
Changed lines 8-9 from:
        /opt/bin/ntpclient -h pool.ntp.org -s >/dev/null
        /usr/sbin/hwclock -s >/dev/null
to:
        /opt/bin/ntpclient -h pool.ntp.org -s &>/dev/null
        /usr/sbin/hwclock -s &>/dev/null
Changed line 12 from:
        /usr/sbin/hwclock -s >/dev/null
to:
        /usr/sbin/hwclock -s &>/dev/null
October 24, 2004, at 10:51 AM by rwhitby --
Changed lines 8-9 from:
        /opt/bin/ntpclient -h time.nist.gov -s >/dev/null
to:
        /opt/bin/ntpclient -h pool.ntp.org -s >/dev/null
        /usr/sbin/hwclock -s >/dev/null
Changed lines 11-12 from:
        /usr/bin/hwclock
        /usr/bin/hwclock -s >/dev/null
to:
        /usr/sbin/hwclock
        /usr/sbin/hwclock -s >/dev/null
October 18, 2004, at 02:42 PM by rwhitby --
Changed lines 1-24 from:

Describe {{Ntpclient}} here.

to:

Here is the /unslung/rc.rstimezone diversion script that I use:

 #!/bin/sh

 /usr/sbin/Set_TimeZone >/dev/null

 if [ -x /opt/bin/ntpclient ]; then
        /opt/bin/ntpclient -h time.nist.gov -s >/dev/null
 else
        /usr/bin/hwclock
        /usr/bin/hwclock -s >/dev/null
 fi

 return 0

I also changed the hwclock entry in /etc/crontab into a ntpclient entry, and used the flashfs script to save it, and then reload that on each boot using the following /unslung/rc.local diversion script:

 #!/bin/sh

 if [ -f /share/flash/data/flashfs.tar.gz ]; then
        /sbin/flashfs load
 fi

 return 1
view · edit · print · history · Last edited by Marco.
Based on work by avgjoe, Darek, Julius, Rob Lockhart, Mark, VivekKhera, Simon Budig, Sharth, BiG, bobtm, anonymous, ju55i, rwhitby, and scott.
Originally by rwhitby.
Page last modified on September 01, 2008, at 12:40 AM