Cron jobs automate maintenance tasks by running a set of command-line at a specific time. Generally, all user accounts can configure cron jobs, although for security reasons non-root cron jobs can be disabled.

The file containing cron tasks is called the crontab and is usually located in /usr/spool/cron/crontab/ or /var/spool/cron/crontab/.


The `crontab' command is used to view and edit cron entries. Crontabs cannot, and should not, be edited directly. The cron daemon maintains a database of tasks to run. Manual changes to the crontab file will, at best, be ignored and, at worst, corrupt the internal database of cron.

On some machines (Sun), using "crontab -e" will start up an editor ("vi" or "emacs") that can be used to edit ("-e") the crontab. On all other machines, crontab is used line "niload" on NeXTStep:

  1. List the current crontab to a file: "crontab -l > /tmp/cronlist"
  2. Edit the file: "vi /tmp/cronlist". The file is white-space deliminated. The first six fields are: 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 with 0=Sunday). All other entries are the command to execute. This command may contain semicolons (but must be one line; no line breaks. To use multiple lines, specify a "\" at the end of the line). This command is executed by /bin/sh. Multiple times can be used. For example:
    1,15 4-6,10 * * * _command_
    This crontab entry will execute `command' every day ("*") of every week ("*") and every day of the week ("*") at the following times: 4:01, 4:15, 5:01, 5:15, 6:01, 6:15, 10:01, and 10:15.
  3. Same the modifications.
  4. Load the changes into the crontab:
    • Sun, HP, SGI, Linux: `crontab /tmp/cronlist'
    • NeXT: `crontab < /tmp/cronlist'
  5. Make sure the changes were loaded: `crontab -l'

Ideal Configuration

Ideally, we want to have 3 main cron files run by all machines:

  • cron.monthly: perform monthly tasks such as archiving log files and wtmp.
  • cron.weekly: perform weekly tasks such as cleaning nfs and dqs files, remaking whatis database, and rotating log files.
  • cron.daily: perform daily tasks such as cleaning /tmp, /scr, and core files. Additionally, this runs `netdate' which syncronizes the time on all machines the the department.

Additionally, there should be cron jobs specific to each host. These jobs should not be located in the crontab, but rather in a host specific file. (This way, we do not need to invoke "crontab" on each host to make changes.) The names of the host specific files are:

  • cron.monthly.hostname
  • cron.weekly.hostname
  • cron.daily.hostname

If these files exist, then they are executed. If they do not exist, then they are ignored. The system cron.monthly, cron.weekly, and cron.daily scripts should look for the host-specific files.

Ideally, every host should only have three entries in the crontab: cron.monthly, cron.weekly, and cron.daily. (An alternate ideal setup would be having one cron entry that knows if it is a daily, weekly, or monthly execution.)

Current Configuration

Most hosts properly execute cron.monthly, cron.weekly, and cron.daily. Although some hosts may be missing this configuration.

The host-specific cron files have been mostly ignored. Systems that have them include polonius and io. Systems that should have them include Kyoto, Ulm, and London.

Maintenance Schedule

Generally, cron does not require maintenance. Problems with cron are e-mailed to root.

Known Problems



  • O'Reilly: Essential System Administration
  • man cron, crontab, tztab