Unoffical empeg BBS

Quick Links: Empeg FAQ | Software | RioCar.Org | Hijack | jEmplode | emphatic
Repairs: Repairs | Addons: Eutronix | Cases

Topic Options
#306997 - 07/02/2008 15:49 NTP sync?
Robotic
pooh-bah

Registered: 06/04/2005
Posts: 2026
Loc: Seattle transplant
After recent personal linux/empeg update lessons and successes I've been re-visiting my old thoughts about using empwake on my player. After updating the DST files I noticed that the empeg's clock was waay out, having been set once and only once a few (short) years ago.

I know in the Windows world there are tiny applications that will reach out across a network to sync up the system clock with NTP.

I did some (brief) surfing around for such things for linux and found some info.

I thought, "How cool would that be if the player sync'ed the clock on boot-up if there were a network around?"

Does anyone know what's involved in getting a linux machine to sync up with NTP and what issues might be involved in applying this to an empeg?
It could be a fun first experience for me, but I'd need a little hand-holding.
_________________________
10101311 (20GB- backup empeg)
10101466 (2x60GB, Eutronix/GreenLights Blue) (Stolen!)

Top
#306998 - 07/02/2008 15:58 Re: NTP sync? [Re: Robotic]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 13494
Loc: Canada
Most of my players have this in their config.ini:

[hijack]
;@MENUEXEC Set_Date_Time /rdate -s 10.0.0.2 &>/dev/null

This allows me to reset the date/time at will from the Hijack menu, using my internal server (10.0.0.2) as a time reference.

I think the same thing might also work from EXEC_ONCE, except then it would need a script that could be more clever about waiting for the network to come before issuing the command.

Cheers

Top
#306999 - 07/02/2008 15:59 Re: NTP sync? [Re: Robotic]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
There are two different ways that you can synchronize your time on a Unix machine. One way is a daemon that runs and constantly checks remote time servers for the current time, modifying the local clock frequently. Another is a simple program that just checks once and sets the time.

I think that the first is overkill for a system that isn't likely to be up for a long period of time. The second is pretty easy. Just get an ntpdate binary and have it run upon boot. It should be pretty easy to check to see if the network is up by searching the output of 'ifconfig eth0' for 'UP'.
_________________________
Bitt Faulk

Top
#307002 - 07/02/2008 16:05 Re: NTP sync? [Re: wfaulk]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 13494
Loc: Canada
Originally Posted By: wfaulk
It should be pretty easy to check to see if the network is up by searching the output of 'ifconfig eth0' for 'UP'.

Of course that does require also hunting down and installing ifconfig. And the script should be slightly more clever to wait a few seconds for the network if it is not up, whilst not holding up the player software during the process.

Cheers

Top
#307003 - 07/02/2008 16:10 Re: NTP sync? [Re: mlord]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
There's no ifconfig on the player? Argh. How does it set IP addresses?

You might be able to figure it out by parsing /proc/net/route?
_________________________
Bitt Faulk

Top
#307005 - 07/02/2008 16:29 Re: NTP sync? [Re: wfaulk]
peter
carpal tunnel

Registered: 13/07/2000
Posts: 4140
Loc: Cambridge, England
Quote:
There's no ifconfig on the player? Argh. How does it set IP addresses?

"There's no Winamp on the player? Argh. How does it play MP3s?"

wink

The player code contains the same syscalls that ifconfig would make. (See, for instance, Stevens, UNPvol1, sec16.7.)

Peter

Top
#307007 - 07/02/2008 16:52 Re: NTP sync? [Re: peter]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Yeah, I figured. I just wanted to make sure that Mark wasn't mistaken by forcing someone to look.
_________________________
Bitt Faulk

Top
#307014 - 07/02/2008 17:15 Re: NTP sync? [Re: mlord]
Robotic
pooh-bah

Registered: 06/04/2005
Posts: 2026
Loc: Seattle transplant
Originally Posted By: mlord
Most of my players have this in their config.ini:

[hijack]
;@MENUEXEC Set_Date_Time /rdate -s 10.0.0.2 &>/dev/null

This allows me to reset the date/time at will from the Hijack menu, using my internal server (10.0.0.2) as a time reference.

I think the same thing might also work from EXEC_ONCE, except then it would need a script that could be more clever about waiting for the network to come before issuing the command.

Cheers

Ah- interesting! Perhaps I should just learn a bit more about setting up my home PC as a time server for the empeg to query when instructed to via your Hijack menu.
Hmm... it's not automatic, but sounds simple enough.

How do other applications 'reach out and check'? I see autohijack could (once upon a time) do something like that. I suppose most folks use jEmplode for updating Hijack these days...

Setting the empeg clock could also be done externally somehow, I guess... a batch file that talks via ftp or (dreaming now) an adjunct to (j)Emplode?
_________________________
10101311 (20GB- backup empeg)
10101466 (2x60GB, Eutronix/GreenLights Blue) (Stolen!)

Top
#307016 - 07/02/2008 17:39 Re: NTP sync? [Re: Robotic]
Robotic
pooh-bah

Registered: 06/04/2005
Posts: 2026
Loc: Seattle transplant
_________________________
10101311 (20GB- backup empeg)
10101466 (2x60GB, Eutronix/GreenLights Blue) (Stolen!)

Top
#307206 - 12/02/2008 15:25 Re: NTP sync? [Re: Robotic]
Robotic
pooh-bah

Registered: 06/04/2005
Posts: 2026
Loc: Seattle transplant
I've been meaning to play around with ntpdate, rdate, and ifconfig one evening soon. I've done some reading about them (mostly what's available are the help files).
I figure I can't really screw anything up, so long as I don't delete anything from the empeg that I'm not supposed to. lol

/babe in the linux woods
_________________________
10101311 (20GB- backup empeg)
10101466 (2x60GB, Eutronix/GreenLights Blue) (Stolen!)

Top
#307235 - 14/02/2008 02:37 Re: NTP sync? [Re: Robotic]
Robotic
pooh-bah

Registered: 06/04/2005
Posts: 2026
Loc: Seattle transplant
Hmm...
http://packages.debian.org/etch/ntpdate
It's the 'arm' package, I'm supposing...
...or should I not be looking at Debian 'packages'?

Hmm, hmm...
http://www.eecis.udel.edu/~ntp/ntp_spool/html/ntpdate.html
It says
Quote:
-t timeout
Specify the maximum time waiting for a server response as the value timeout, in seconds and fraction. The value is is rounded to a multiple of 0.2 seconds. The default is 1 second, a value suitable for polling across a LAN.

Does that mean that all other boot-up actions are delayed by this value if no server is found?
I'm assuming that ntpdate is not smart enough to give up immediately if it doesn't see a network... which is why Bitt and Mark are leaning on ifconfig to find that out...
_________________________
10101311 (20GB- backup empeg)
10101466 (2x60GB, Eutronix/GreenLights Blue) (Stolen!)

Top
#307236 - 14/02/2008 06:08 Re: NTP sync? [Re: Robotic]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5524
Loc: London, UK
Originally Posted By: Robotic
...or should I not be looking at Debian 'packages'?


Debian packages are fine. Etch might be a bit new. You want ARM-compiled potato packages, if I recall correctly.

The empeg doesn't have dpkg, so you'll have to unpack and install the binaries yourself. You'll find instructions on how to do this a short way down the Lazy Bastard's Guide to Cloning your empegs.

_________________________
-- roger

Top
#307238 - 14/02/2008 09:31 Re: NTP sync? [Re: Roger]
peter
carpal tunnel

Registered: 13/07/2000
Posts: 4140
Loc: Cambridge, England
Originally Posted By: Roger
Etch might be a bit new.

Heh, there can't be many places where you can hear that said with a straight face!

Peter

Top
#307246 - 14/02/2008 15:45 Re: NTP sync? [Re: Roger]
Robotic
pooh-bah

Registered: 06/04/2005
Posts: 2026
Loc: Seattle transplant
Thanks, Roger.
LOL - It took me a second to figure out what you meant by a 'potato package'. (lumpy pants jokes aside)
I can't find Debian references to ntp packages for anything earlier than sarge.
_________________________
10101311 (20GB- backup empeg)
10101466 (2x60GB, Eutronix/GreenLights Blue) (Stolen!)

Top
#307248 - 14/02/2008 16:04 Re: NTP sync? [Re: Robotic]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 13494
Loc: Canada
Debian Potato (aka. v2.2) is available here.


Edited by mlord (14/02/2008 17:22)

Top
#307249 - 14/02/2008 16:27 Re: NTP sync? [Re: mlord]
Robotic
pooh-bah

Registered: 06/04/2005
Posts: 2026
Loc: Seattle transplant
Originally Posted By: mlord
Debian Potato is available here.

Ah- Thanks, Mark! Yes, I see nptdate in the net directory. Great!
_________________________
10101311 (20GB- backup empeg)
10101466 (2x60GB, Eutronix/GreenLights Blue) (Stolen!)

Top
#307269 - 15/02/2008 03:11 Re: NTP sync? [Re: Robotic]
Robotic
pooh-bah

Registered: 06/04/2005
Posts: 2026
Loc: Seattle transplant
The readme file says
Quote:
Note that ntpdate is run during system startup. If you specify
servers that are not reachable at boot time, you'll have to wait for
ntpdate to time out looking for them. In this case, you might want to
consider editing /etc/init.d/ntpdate to comment out the invocation
there, and add a fragment to your ppp/isdn/whatever startup scripts
instead.

Also, note that ntpdate is *not* really intended to be used by servers with
good network connectivity. The 'ntp' package, which provides a persistent
daemon that does a better job of keeping system time than even a cron'ed
invocation of ntpdate, is a better choice for systems with good network
connectivity. It may be useful to also have ntpdate on systems that run
ntp, so that the clock is warped to approximately the right time at boot
before ntp is launched, but there are options to ntpd that can be added to
the init.d script for the ntp package that can accomplish much the same
thing.

Ok, off to read Roger's site...
_________________________
10101311 (20GB- backup empeg)
10101466 (2x60GB, Eutronix/GreenLights Blue) (Stolen!)

Top
#307270 - 15/02/2008 06:07 Re: NTP sync? [Re: Robotic]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5524
Loc: London, UK
Originally Posted By: Robotic
The readme file says
Quote:
Note that ntpdate is run during system startup.



Also, the empeg doesn't have init scripts, so you'll have to use Hijack's @EXEC stuff. I don't know if that's asynchronous or not.

I've got ntpdate on my empeg, but it runs when I drop to a shell prompt over serial, which I used to do regularly. I don't remember how the hell I set that up though. I'll dig out a serial cable and take a look later...
_________________________
-- roger

Top
#307278 - 15/02/2008 13:14 Re: NTP sync? [Re: Roger]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 13494
Loc: Canada
I just run it on command from the Hijack menu. Full control over it that way, and no serial cable required.

Cheers

Top
#307283 - 15/02/2008 15:14 Re: NTP sync? [Re: mlord]
Robotic
pooh-bah

Registered: 06/04/2005
Posts: 2026
Loc: Seattle transplant
My first task will be to move the files into the correct locations.
Baby steps, I know. lol

After that, I'll work out running it from a prompt, then the Hijack exec stuff.
Should be fun. wink
_________________________
10101311 (20GB- backup empeg)
10101466 (2x60GB, Eutronix/GreenLights Blue) (Stolen!)

Top
#307505 - 21/02/2008 04:12 Re: NTP sync? [Re: Robotic]
Robotic
pooh-bah

Registered: 06/04/2005
Posts: 2026
Loc: Seattle transplant
You people are too polite.

"Silly n00b, go search the BBS!"

=facepalm=
*sigh*
_________________________
10101311 (20GB- backup empeg)
10101466 (2x60GB, Eutronix/GreenLights Blue) (Stolen!)

Top