Contents /
Previous /
Next
cron - daemon to execute scheduled commands
Cron reads the file /etc/crontab and schedules the listed jobs.
/etc/crontab: List of periodic jobs read by crond.
/etc/crontab consists of single line definitions:
time user executable
time pattern: minute, hour, day of the month, month, weekday
Example:
50 13,14 * * 5,6,7 root /usr/bin/play /etc/some_music.wav
will play a WAV file (as user root) at
13:50:00 and at 14:50:00
on Friday, Saturday, and Sunday
The cron-installation itself uses a cron-job that executes scripts the
following directories:
- cron.hourly
- cron.daily
- cron.weekly
- cron.monthly
You may (as root) put your own scripts these directories.
Cron for Regular Users
Commonly only the root user has the right to change the /etc/crontab file.
Crontab files for regular users are kept separately under /var:
Cron searches /var/spool/cron/tabs for crontab files which
are named after user accounts and loads them into memory.
These file are not intended to be edited directly.
The crontab command should be used to maintain crontab files
for individual users:
crontab [ -u user ] { -l | -r | -e }
Options:
-l display current crontab.
-r remove current crontab.
-e edit current crontab using the
editor specified by the VISUAL or
EDITOR environment variables (Vi).
The user crontab table has six columns (not seven as the global one):
minute, hour, day-of-month, month, day-of-week and the command to be executed.