Cron Jobs in /etc/crontab on FreeBSD

Updated: 2004/09/04  NOT CURRENT with Release 4.9
Date: 2000/12/06
Author: Jesse Monroy, Jr. 

This document describes the default installation of cron jobs for FreeBSD. The jobs are run by cron(8). The control file is /etc/crontab. The description of /etc/crontab can be found in the man page, crobtab(5). All jobs run as root, as is specified in the crontab.

An investigation of /etc/crontab will show that the scripts for the jobs are stored in a subdirectory tree under /etc/periodic. In /etc/periodic, there are three (3) subdirectories, each corresponding to the periodic nature of the job; daily, weekly and monthly. The subdirectory /etc/perodic/daily has jobs that run everyday. By the same methodology /etc/periodic/weekly and /etc/periodic/monthly contain the jobs to be run weekly and monthly, respectively. The time and date (if applicable) that they run is define in /etc/crontab.

The order of the jobs is determined (in SystemV style) by the prefix to a file name. As such, all files have a prefix number that allows job '100.clean-disks' to run before job '110.clean-tmps'. The remainder of the filename is traditionally used as a terse description of the it's function.

The table that follows contains detailed information about each script install by default. The information was derived from investigation of the cron script or comments extracted from the script. The table makes note of this for historical reasons.

The user is cautioned that this table is not a definition of the jobs, but a description of those jobs listed as of the date of this writing. Given the volitale nature of the system, the user is advised, when in doubt, "read the source".

Special Note: If you're looking for answer to user crontab, a common problem is listed in the FAQ under DEPRICATED http://www.freebsd.org/FAQ/admin.html#ROOT-NOT-FOUND-CRON-ERRORS.
Now Use (Updated Sept. 4, 2004).
http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/admin.html#ROOT-NOT-FOUND-CRON-ERRORS.

/etc/periodic/daily:
number of jobs: 22
Job Runs by Default What it does
100.clean-disks NO Uses find(1) to remove a.out, core dumps (*.core) and some emacs files.
110.clean-tmps NO Uses find(1) to do some cleanup of temporary files.
The comments say:
Use at your own risk, but for a long-living system, this might come more useful than the boot-time cleaning of /tmp. If /var/tmp and /tmp are symlinked together, only one of the below will actually run.
120.clean-preserve YES Removes files in /var/preserve more than 7 days old.
130.clean-msgs YES Removes system messages older than 21 days
Note: This uses msgs(1) which inconsitent documentation. It does explain the option used, but you must really look for it. It is easy to miss.
140.clean-rwho YES Removes files from /var/rwho that are more than 7 days old.
200.backup-passwd YES Backup passwd and group files, if it is different from the last backup.
Sends you the diff(1). Verifying group file syntax with chkgrp(8).
210.backup-aliases YES Backs up mail aliases (/etc/aliases).
220.backup-distfile YES Backs up /etc/Distfile.
Part of rdist(1). See also 320.rdist.
300.calendar NO Processes the "calender" files for all users and mail the result to them.
The comments say:
calendar -a' needs to die. Why? Because it's a bad idea, particular networked home directories, but also in general. If you want the of `calendar' mailed to you, set up a cron job to do it, run it from your ~/.profile or ~/.login.
310.accounting YES Rotates accounting logs (/var/account/acct) and gathers statistics with "sa -s".
320.rdist YES Runs rdist(1) with "/etc/Distfile".
330.news YES Expires news articles - This is present only for backwards compatibility, usually the news handles this on its own).
Note: This script runs "/etc/news.expires", which does not exists by default, so it silently failes.
340.uucp YES Local cleanup of UUCP files. This is for backwards compatibility, /etc/uuclean.daily doesn't exist by default.
400.status-disks YES Displays which filesystems capacity without NFS mounts (df -k -t nofs).
Displays with files need backing up by doing "dump -W" (which reads from /etc/dumpdates).
Note: /etc/dumpdates is empty by default, so the second part of this script really does nothing.
410.status-uucp YES UUCP status (uustat -a) Does not really do anything.
420.status-network YES Network interface status (netstat -i)
430.status-rwho YES Local network system status (ruptime) OR Local system status (uptime).
Note: Since /var/rwho contains no files "ruptime" does not get run.
440.status-mailq YES Prints a summary of mail messages queued for future delivery.
Note: There is a "short, better formatted" version for busy mail servers.
450.status-security YES Security check
This script calls another script (/etc/security) that:
  • Checks setuid files and devices
  • Checks uids of zero(0).
  • Checks for passwordless accounts
  • Shows denied, reset or unreached packets for ipfw(8), if running.
  • Shows which rules have reached their log limits for ipfw(8), if running.
  • Shows kernel log messages
  • Shows login failures
  • Shows tcp_wrapper warning messages, if running.
460.status-mail-rejects YES Check for rejected mail hosts in /var/log/maillog.
999.local YES Run the old /etc/daily.local script. This is really for backwards more than anything else.

/etc/periodic/weekly:
number of jobs: 7
Job Runs by Default What it does
120.clean-kvmdb YES Deletes kernel database files more that 7 days old.
300.uucp YES Clean up UUCP - This is really here for backwards compatibility, clean.weekly is not created by default anymore.
310.locate YES Rebuilds locate database (/var/db/locate.database).
320.whatis YES Rebuilds whatis database by running /usr/libexec/makewhatis.local
330.catman NO Reformats manual pages by running /usr/libexec/catman.local
340.noid NO Check for files belongs to an unknown user or unknown group using the very ubiquitious find(1).
999.local YES Runs /etc/weekly.local

/etc/periodic/monthly:
number of jobs: 2
Job Runs by Default What it does
200.accounting YES Does login accounting
999.local YES Runs /etc/monthly.local
Refererence:

cron(8) - http://www.freebsd.org/cgi/man.cgi?query=cron&sektion=8
crontab(5) - http://www.freebsd.org/cgi/man.cgi?query=crontab&sektion=5


webmaster@svbug.com