| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
cron/crontab - Execute Scheduled Commands cron is a daemon that monitors the /etc/crontab file on a regular basis, to find commands that are scheduled for repetitive execution at various times. The crontab command is used to add entries to this file so that task can be run. An example crontab file is: SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/
# run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly Of interest are the initial fields, in the lines underneath the entry # run-parts. The first field (of five which are separated by spaces) contains the minutes (0 -59), the second - the hour (0-23), the third - the day of the month (1-31), next the number of the month (1-12), and finally the day of the week (0-7, both 0 and 7 are Sunday). An asterisk (*) in any field selects the whole range of that field. Reading the last entry in the above example shows that this command will run at the 42nd minute, the fourth hour of the first day of the month (at 4:42 am on the first of the month). A text file can be created containing the time specification followed by at the command (or a script file) that is to be executed. Such as: 8 03 3,18 * * payroll If it is saved with a file name of payrollcron. Then the crontab command can be used as follows: crontab payrollcron This would cause the contents of the file payrollcron to be submitted to the cron daemon to run. The file payroll would be run on the third and 18th of the month at 3:08 A.M.
Home - Table Of Contents - Contact Us CertiGuide to A+ (A+ 4 Real) (http://www.CertiGuide.com/apfr/) on CertiGuide.com Version 1.0 - Version Date: March 29, 2005 Adapted with permission from a work created by Tcat Houser et al. CertiGuide.com Version © Copyright 2005 Charles M. Kozierok. All Rights Reserved. Not responsible for any loss resulting from the use of this site. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||