Essential Administrative Techniques
In this section, we consider several system facilities with which system administrators need to be intimately familiar.
Periodic Program Execution: The cron Facility
cron is a Unix facility that
allows you to schedule programs for periodic execution. For example,
you can use cron to call a
particular remote site every hour to exchange email, to clean up
editor backup files every night, to back up and then truncate system
log files once a month, or to perform any number of other tasks. Using
cron, administrative functions are
performed without any explicit action by the system administrator (or
any other user).[6]
For administrative purposes, cron is useful for running commands and
scripts according to a preset schedule. cron can send the resulting output to a log
file, as a mail or terminal message, or to a different host for
centralized logging. The cron
command starts the crond daemon,
which has no options. It is normally started automatically by one of
the system initialization scripts.
Table 3-3 lists the
components of the cron facility on
the various Unix systems we are considering. We will cover each of
them in the course of thissection.
Table 3-3. Variations on the cron facility
Component | Location and information |
|---|---|
crontab files | Usual: /var/spool/cron/crontabs FreeBSD: /var/cron/tabs, /etc/crontab Linux: /var/spool/cron (Red Hat), /var/spool/cron/tabs (SuSE), /etc/crontab (both) |
crontab format | Usual: System V (no username field) BSD: /etc/crontab ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access