>>> SETTING Time/TIMEZONE (will update date and time at each router reboot)
1- echo "EST5EDT,M3.2.0/2:00:00,M11.1.0/2:00:00" > /etc/TZ (Set your TimeZone)
2- vim /etc/init.d/timedate
|-->
#!/bin/sh /etc/rc.common
START=90
start() {
rdate -s <NTP Server Address>
}
3- chmod 755 /etc/init.d/timedate
4- /etc/init.d/timedate enable
5- reboot
Topic: Set Date/Eastern Time at BOOT (Kamikaze 7.06)
The content of this topic has been archived on 14 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.
I tried this, but when I try to enable it I get a message that says it does not exist.
Que pasa? I included the START string and entered the date query into the function exactly as above.
Just so everyone knows, it's not the string presented above to enable.
It's actually:
/etc/rc.common /etc/init.d/timedate enable
(Last edited by napierzaza on 3 Aug 2007, 20:35)
/etc/init.d/timedate:
#!/bin/sh /etc/rc.common
START=90
start() {
rdate -s <NTP Server Address>
}
/etc/init.d/timedate start
/etc/init.d/timedate enable
I don't know if you're version works, mine does I believe, the first example doesn't. Does mine not work or are you just posting a similar fix?
in fact your example returns the same error I've been getting
root@openwrt:~# /etc/init.d/timedate start
-ash: /etc/init.d/timedate: not found
root@ openwrt:~# /etc/init.d/timedate enable
-ash: /etc/init.d/timedate: not found
root@ openwrt:~#
(Last edited by napierzaza on 4 Aug 2007, 05:30)
Actually, though mine gives no error, it also does not set the time.
Also using the below is actually creating the files in the rc.d directory.
/etc/rc.common /etc/init.d/timedate enable
(Last edited by napierzaza on 4 Aug 2007, 15:19)
Alas, according to logread it's still not working:
Dec 31 19:00:31 openwrt user.info : /etc/init.d/rcS: /etc/init.d/rcS: 8: /etc/rc.d/S90timedate: not found
My guess is that the boot up script is not actually wrapping the rc.common with the cron script. And that NOT incorporating the command into a function will cause it to function.
I find it really strange that I'm the only one getthing this, has anyone else tried this on the WRT54GS or WRT54G bin image? Because I am completely following the above directions and getting nowhere.
I don't know what to say... The directions above work for me so this is why I posted this documentation here..... It doesn't matter what version of router you have. Are you using Kamikaze 7.06? version 7.07 also work fine.
I want to use fr.pool.ntp.org to sync time but doesn't work. can you give an example valid server adress ?
btw, fr.pool.ntp.org works with ntpclient or windows time sync ...
thx!
I'd really suggest installing/using the ntpclient package and make use of UCI (/etc/config/ntpclient). Of course, you still have to set the timezone in /etc/TZ manually. ntpclient is more easy to sync the time...
(Last edited by forum2006 on 10 Aug 2007, 09:38)
I am using Kamikaze 7.07
It might somehow be significant in terms of what hardware, because maybe the image built for 2.4 broadcoms is broken.
I don't think you're making it up. But I'm making very certain that I follow your directions and they are just giving me errors
(Last edited by napierzaza on 10 Aug 2007, 20:19)
Try making it executable:
chmod +x /etc/init.d/timedate
/etc/init.d/timedate enable
If you run "ls -l /etc/init.d" you'll see that the scripts there all have the "x" bits set. New scripts need that bit set, too.
rdate fails for me, I don't care why. So I use nptclient instead. Also, I have combined the methods above (on this page) with some methods from another page.
At boot, I use the ntp.org pool, and set the clock directly (without the -l option, therefore not using the adjtimex(2) call -- see the ntpclient author's site for more information about using the -l option.)
/etc/init.d/clockset: (Remember to run ntpclient it in the background, in case it hangs.)
#!/bin/sh /etc/rc.common
START=90
start() {
/usr/sbin/ntpclient -sh us.pool.ntp.org &
}
Then I do the enable command: root@wrt:/etc/# /etc/init.d/clockset enable
____________________
That should do to initially set the clock on boot, provided upstream connection to the ntp pool servers. However, I also want to synchronize the clock to my LAN. I already have a machine (simply "lan-time" here) which is a ntp server. So...
/usr/local/timesync.sh: (Remember to run ntpclient it in the background, in case it hangs.)
#/bin/sh
/usr/bin/killall ntpclient > /dev/null 2> /dev/null
/usr/sbin/ntpclient -s -l -h lan-time &
root's crontab:
*/30 * * * * /usr/local/timesync.sh
These parts serve to keep the time synchronized with the rest of my lan.
-- Nate
EDIT: Changed */10 to */30 in root's crontab. Checking every 10min is just ... I like 30 better.
(Last edited by arfyness on 6 Apr 2009, 23:18)
The discussion might have continued from here.