Moxa V2416-W7E [16/88] Updating the time automatically

Moxa V2416-XPE [16/88] Updating the time automatically
V2416 Linux User's Manual Software Configuration
2-9
Updating the Time Automatically
This section describes how to use a shell script to update the time automatically.
Example shell script for updating 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. For example, fixtime.
How to run the shell script automatically when the kernel boots up
Because the root file system is mounted in Read-only mode, we need to re-mount it using writable permission.
# mount -o remount,rw /dev/hda1 /
Copy the example shell script fixtime to the directory /etc/init.d, and then use chmod 755 fixtime
to change the shell script mode.
# chmod 755 fixtime
Next, use vi editor to edit the file /etc/inittab.
# vi /etc/inittab
Add the following line to the bottom of the file:
ntp : 2345 : respawn : /etc/init.d/fixtime
After you finish writing or modifying the code, remember to execute umount / to change the root directory
back to Read-only mode.
# umount /
Use the command #init q to re-initialize the kernel.
# init q
Enabling and Disabling Daemons
The following daemons are enabled when the V2416-LX boots up for the first time.
Snmpd: SNMP Agent Daemon
Telnetd: Telnet Server/Client Daemon
Inetd: Internet Daemons
Ftpd: FTP Server/Client Daemon
Sshd: Secure Shell Server Daemon
Httpd: Apache WWW Server Daemon
Type the command
ps –ef to list all processes currently running.
MOXA:~# ps -ef
PID Uid VmSize Stat Command
1 root 1296 S init
2 root S [keventd]

Содержание

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

Скачать