Moxa KM-2430-T [24/52] Ntp server setting

Moxa KM-2430-T [24/52] Ntp server setting
ioPAC RTU Software RTU Management
3-10
NTP Server Setting
The ioPAC RTU controller has an NTP server setting. First, configure the time sync server at the path
/etc/ntp.conf and use the /etc/init.d/ntpd start command to start the NTP server.
root@Moxa:/etc# /etc/init.d/ntpd start
Starting ntp server
Use the ntpq -pn command to check the NTP server status, and ntpd g l /etc/ntp_log & to debug the NTP
server.
NOTE
ntpd
and ntpdate cannot be used at the same time because the UDP port 123 will be occupied.
Remember to use
hwclock-w to update the RTC time, or else the time sync settings will be lost after you
restart the device
.
Executing Scheduled Commands with Cron
Daemon
Start cron from the /etc/rc.d/rc.local directory. It will return immediately, so you don’t need to start it with
‘&’ to run in the background.
The Cron daemon will search /etc/cron.d/crontab for crontab files, which are named after accounts in
/etc/passwd.
Cron wakes up every minute, and checks each command to see if it should be run that minute. Modify the file
/etc/cron.d/crontab to set up your scheduled applications. Crontab files have the following format:
mm h dom mon dow user command
min hour date month week user command
0-59
0-23
1-31
1-12
The following example demonstrates how to use cron.
How to use cron to update the system time and RTC time every day at 8:00
Step 1: Write a shell script named fixtime.sh and save it to /home/.
#!/bin/sh
ntpdate time.nist.gov
hwclock –w
exit 0
Step 2: Change the fixtime.sh mode.
#chmod 755 fixtime.sh
Step 3: Modify the /etc/cron.d/crontab file to run fixtime.sh at 8:00 every day.
Add the following line to the end of crontab:
* 8 * * * root/home/fixtime.sh
Step 4: Enable the cron daemon manually.
#/etc/init.d/crond start
Step 5: Enable cron when the system boots up.
Add the following line in the /etc/rc.d/rc.local file
#/etc/init.d/crond start

Содержание

Скачать