Updating The Time Automatically - Korenix JetBox 8100 User Manual

Embedded linux
Hide thumbs Also See for JetBox 8100:
Table of Contents

Advertisement

Updating the Time Automatically

3.3.3
In this subsection, we show how to use a shell script to update the time
automatically.
Example shell script to update the system time periodically
#!/bin/sh
ntpdate time.stdtime.gov.tw
# You can use the time server's ip address or domain
# name directly. If you use domain name, you must
# enable the domain client on the system by updating
# /etc/resolv.conf file.
hwclock –w
sleep 100
# Updates every 100 seconds. The min. time is 100 seconds. Change
# 100 to a larger number to update RTC less often.
Save the shell script using any file name. E.g., fixtime
How to run the shell script automatically when the system boots up
Copy the example shell script fixtime to directory /etc/init.d, and then use
chmod 755 fixtime to change the shell script mode.
Next, use vi editor to edit the file /etc/inittab.
Add the following line to the bottom of the file:
:: respawn : /etc/init.d/fixtime
Reboot jetbox8100 to take effect
JetBox 8100 User Manaual_Linux_1.1
Figure 3-8 System Time update automatically
21

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Jetbox 8100-lJetbox 8100-lm

Table of Contents