Moxa V2401-LX [23/108] Cron daemon for executing scheduled commands

Moxa V2401-LX [23/108] Cron daemon for executing scheduled commands
V2401/2402 Series Linux User’s Manual Software Configuration
2-16
Cron—Daemon for Executing Scheduled Commands
The Cron daemon will search /etc/crontab for crontab files.
Cron wakes up every minute and checks each command to see if it should be run in that minute.
When executing commands, output is mailed to the owner of the crontab (or to the user named in
the MAILTO environment variable in the crontab, if such a user exists).
Modify the file /etc/crontab to set up your scheduled applications. Crontab files have the
following format:
mm h dom mon dow user command
minute hour date month week user command
0-59 0-23 1-31 1-12 0-6 (0 is Sunday)
For example, if you want to launch a program at 8:00 every day
The following example demonstrates how to use Cron to update the system time and RTC time
every day at 8:00.
1. Write a shell script named fixtime.sh and save it to /home/.
#!/bin/sh
ntpdate time.stdtime.gov.tw
hwclock –w
exit 0
2. Change mode of fixtime.sh
# chmod 755 fixtime.sh
3. Modify /etc/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
#minute hour date month week user command
* 8 * * * root /path/to/your/program

Содержание

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

Скачать