Is there a way to set the time from a network timeserver on boot?

1 view
Skip to first unread message

Jono

unread,
Feb 3, 2009, 4:25:50 PM2/3/09
to Emprex ME1 - HD Multimedia Enclosure
I find my ME1 date/time resets each time I disconnect the power.
Is there a way to automatically set the clock via the internet on
bootup?

regards,
Jono

danny

unread,
Feb 4, 2009, 10:12:33 AM2/4/09
to Emprex ME1 - HD Multimedia Enclosure
if you install the debian image usually used for getting Samba onto
the device, (instructions on the ME1 blogger page, and the forums
(there's a link on this site, and some realtek forum for other media
stations about how to install this).

once it's installed you can run the command
apt-get install ntpdate

after this is installed you can run
ntpdate pool.ntp.org

each time the device is started. then the device will automatically
update the time from a central server.

J Watters

unread,
Feb 4, 2009, 11:57:56 AM2/4/09
to Empre...@googlegroups.com
2009/2/4 danny <daniel_...@yahoo.com>:

>
> if you install the debian image usually used for getting Samba onto
> the device, (instructions on the ME1 blogger page, and the forums
> (there's a link on this site, and some realtek forum for other media
> stations about how to install this).
>
> once it's installed you can run the command
> apt-get install ntpdate
>
> after this is installed you can run
> ntpdate pool.ntp.org
>
> each time the device is started. then the device will automatically
> update the time from a central server.
>

Awesome - I have the SAMBA hack running, so I will attempt this when I
get home.
Thanks

Jono

Stoobs

unread,
Feb 4, 2009, 12:28:27 PM2/4/09
to Emprex ME1 - HD Multimedia Enclosure

ntpdate is obsolete, so ideally use the newer ntp program:

Chroot into debian.
Type "apt-get update"
Type "apt-get install ntp" (this takes a while)
Test it with "ntpd -g -q" which should set your clock for you the
first time.
(-g means don't panic that the time is SO wrong - set according to the
ntp server and -q means quit after setting the clock)

As long as it all works, exit from your debian environment and add
the following line to /usr/local/etc/auto (before the "exit" line)

chroot /usr/local/etc/hdd/volumes/HDD1/chroot /usr/sbin/ntpd -g -q

This will set the clock every time the machine boots, without having
to telnet to do it...

Stuart

J Watters

unread,
Feb 4, 2009, 12:35:16 PM2/4/09
to Empre...@googlegroups.com
2009/2/4 Stoobs <stuar...@gmail.com>:


Even more awesome. Now I don't have to ask what the equivalent of
autoexec.bat is.
Thanks.

Jono.

danny

unread,
Feb 6, 2009, 6:46:29 AM2/6/09
to Emprex ME1 - HD Multimedia Enclosure
you'll find that in the directory

/usr/local/etc on the ME, (not in the debian environment) there is a
file called rcS

you can edit this file using vi

at the end you can add commands, or, a safer way I think is to add a
call to another file (autoexec.sh) that you can store in the same
directory.
At the end of the file add the line.
sh /usr/local/etc/autoexec.sh &

then in the same directory you can create a file called autoexec.sh

in this file you can add the line
chroot /usr/local/etc/hdd/volumes/HDD1/chroot /usr/sbin/ntpd -g -q

as suggested above.

the first line of the file on my autoexec.sh file is actually

sleep 60,

basically if I do something that kills the device, or makes it go into
a loop of rebooting or something from stuff I've added, (all of which
are called in this file), I'll have 60 seconds from boot to telnet to
the device and kill this script before it starts running stuff.
Reply all
Reply to author
Forward
0 new messages