(redirected from Unslung.Ntpclient)
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 pool.ntp.org -s >/dev/null /usr/sbin/hwclock -s >/dev/null else /usr/sbin/hwclock /usr/sbin/hwclock -s >/dev/null fi return 0
I also changed the hwclock entry in /etc/crontab into a ntpclient entry, and used the resling script to save my changes.
The above setup is broken since it overwrites the system time set by
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 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.
- aka, use cron. -Sharth
What is the thing with this metalog stuff? What is it, and how is it related to ntp?
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.
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
The current package (as of January 2006 and firmware 5.5-beta) installs
22 * * * * root /usr/sbin/hwclock --systohc &>/dev/null
NOTE: see Debug Crontab Problems article to read more on
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
I discovered that when I executed the /usr/sbin/hwclock --systohc command, I still got the message:
Timed out waiting for time change.
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. 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