

cron                    System Maintenance                   cron




Execute commands periodically

/etc/cron&

cron is  a daemon  that executes  commands at preset  times.  The
commands and their scheduled execution times are kept in the file
/usr/lib/crontab.

Once each minute cron searches through crontab.  For each command
stored there,  cron compares the current  time with the scheduled
execution time and executes the command if the times match.  When
it  finishes  the  search, cron  sleeps  until  the next  minute.
Because it  never exits, cron should be  executed only once (cus-
tomarily by /etc/rc).

crontab consists of  lines separated by newlines.  Each line con-
sists of  six fields separated  by white space  (tabs or blanks).
The first  five fields describe  the scheduled execution  time of
the  command.  Respectively,  they represent  the  minute (0-59),
hour (0-23),  day of the month (1-31), month  of the year (1-12),
and day  of the week  (0-6, 0 indicates Sunday).   Each field may
contain a single integer in  the appropriate range, a pair of in-
tegers separated  by a hyphen  `-' (meaning all  integers between
the two, inclusive),  an asterisk `*' (meaning all legal values),
or a  comma-separated list of the above  forms.  The remainder of
the line gives the command to be executed at the given time.

For example, the ccrroonnttaabb entry


        29 * * 7 0 msg henry Succotash!


means  that every  hour on  the half-hour  during each  Sunday in
July,  ccrroonn will invoke the command mmssgg, and the user named hheennrryy
will have the message


        daemon: Succotash!


written on his terminal's screen (if he is logged in).

cron recognizes three  special characters and escape sequences in
the crontab.   If a command  contains the percent  character `%',
cron executes only  the portion up to the first  `%' as a command
and passes  the remainder to  the command as  its standard input.
cron translates  any percent characters  `%' in the  remainder to
newlines.  The special  interpretation of `%' can be prevented by
preceding it  with a backslash, `\%'.   Finally, cron removes the
sequence \<nneewwlliinnee> from the  text before passing it to the shell
sh;  this can  be  used to  make  an entry  in  the crontab  more
legible.



COHERENT Lexicon                                           Page 1




cron                    System Maintenance                   cron



cron is  designed for commands  that must be  executed regularly.
Temporal commands  that need to  be executed only  once should be
handled with the command at.

***** Files *****

/uussrr/lliibb/ccrroonnttaabb for stored commands

***** See Also *****

at, init, system maintenance














































COHERENT Lexicon                                           Page 2


