Moxa W325A-LX [34/74] Bin sh ntpdate time nist gov hwclock systohc exit 0

Moxa W406-CE [34/74] Bin sh ntpdate time nist gov hwclock systohc exit 0
W315A/325A Linux User's Manual Managing Embedded Linux
3-9
CronDaemon for Executing Scheduled
Commands
Cron is a scheduling service in Linux. Cron wakes up every minute, and checks the configuration file named
crontab to see if any scheduled commands should be run at the current moment.
Crontab is located in the /etc/cron.d directory. Modify the file /etc/cron.d/crontab to set up your
scheduled applications. Crontab has 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 0-6 (0 is Sunday)
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 –-systohc
exit 0
STEP 2: Change mode of fixtime.sh
#chmod 755 fixtime.sh
STEP 3: Modify /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/cron start
STEP 5: Enable cron when the system boots up.
By default, cron service is disabled on boot. To enable cron service, refer to the section Enabling and Disabling
Daemonsin this chapter

Содержание

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

Скачать