Moxa DA-682A-C7-DPP [11/108] Setting the system clock and the rtc

Moxa DA-682A-C7-DPP [11/108] Setting the system clock and the rtc
DA-682A-DPP Linux Software Software Configuration
2-5
Setting the System Clock and the RTC
The DA-682A-DPP-LX uses two clocks to keep time; one is the system time, and the other is the time provided
by the RTC (Real Time Clock) built into the DA-682A-DPP’s hardware. The system clock is set using the date
command, and the RTC is set using the hwclock command.
WARNING
The RTC time setting on your computer is not in synch with the current time if
the f
ile system check (fsck) utility
shows
the following error on boot up:
Supberblock last mou
nt time (Tue Dec 15 12:00:00 2015) is in the future. UNEXPECTED INCONSISTENCY;
RUN fsck MANUALLY.
To prevent this issue from occuring at the next boot up, synchonize the
system BIOS time with the current
time.
NTP Client
The DA-682A-DPP-LX comes with a built-in Network Time Protocol (NTP) client that can access remote NTP
servers to synchronize your system clock to worldwide reference clocks. To synchronize the system time to a
remote reference clock, use the ntpdate command:
moxa@Moxa:~#sudo ntpdate time.stdtime.gov.tw
Next, set the RTC using the hwclock command:
moxa@Moxa:~#sudo hwclock –w
ATTENTION
Before using the NTP client utility, check your IP address and network settings (gateway and DNS) to make
sure an In
ternet connection is available. For additional information on using NTP (Network Time Protocol
), visit
the project’s home
page at:
http://www.ntp.org
Using a Shell Script for Automatic Updates
As the RTC gets older, it might run slower and fail to accurately track time. This section provides one example
of how a shell script can be used to repeatedly synchronize the RTC to the system clock by using the Linux
initialization table (inittab). Because the system clock will be automatically synched using NTP, the two clocks
will reliably keep time. Other methods are also available, for instance using cron (see the section “Cron for
Executing Scheduled Commands”) or using the at command. The example below shows how to write a simple
shell script for keeping the two clocks synchronized, and how to set the system to continuously run the script
in the background, across sysystem re-boots.

Содержание

Похожие устройства

Скачать