The cron utility is a permanent process, started by /etc/rc.local. cron consults the files in the directory /var/spool/cron/crontabs to find out what tasks are to be done, and at what time.
Each line in a crontab file consists of six fields, separated by spaces or tabs, as follows:
minutes hours day-of-month month day-of-week command
Any of fields 1 through 5 can be a list of values separated by commas. A value can either be a number, or a pair of numbers separated by a hyphen, indicating that the job is to be done for all the times in the specified range. If a field is an asterisk character (*) it means that the job is done for all possible values of the field.
Note: the specification of days may be made by two fields (day of the month and day of the week). If both are specified as a list of elements, both are adhered to. For example,
0 0 1,15 * 1
would run a command on the first and fifteenth of each month, as well as on every Monday. To specify days by only one field, the other field should be set to *. For example,
0 0 * * 1
would run a command only on Mondays.
The command is run from your home directory with an arg0 of sh. Users who desire to have their .profile executed must explicitly do so in the command. cron supplies a default environment for every shell, defining HOME, LOGNAME, USER, SHELL(=/bin/sh), and PATH(=:/usr/ucb:/bin:/usr/bin).
NOTE: Users should remember to redirect the standard output and standard error of their commands! If this is not done, any generated output or errors will be mailed to the user.
Lines that start with # are treated as comments.
0 0 * * * calendar - 15 0 * * * /usr/etc/sa -s >/dev/null 15 4 * * * find /var/preserve -mtime +7 -a -exec rm -f {} ; 40 4 * * * find / -name '#*' -atime +3 -exec rm -f {} ; 0 0 * * 1-5 /usr/local/weekdays 0 0 * * 0,6 /usr/local/weekends
The calendar command runs at minute 0 of hour 0 (midnight) of every day. The /usr/etc/sa command runs at 15 minutes after midnight every day. The two find commands run at 15 minutes past four and at 40 minutes past four, respectively, every day of the year. The /usr/local/weekdays command is run at midnight on weekdays. Finally, the /usr/local/weekends command is run at midnight on weekends.
Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97