cron Tasks
Through the Unix
cron
utilities, you can have your Macintosh run scripts and other programs
at scheduled times or regular intervals. While this is a pretty neat
feature that offers convenience to users and crucial
maintenance-program scheduling for system administrators, Mac OS X
doesn’t ship with any friendly GUI frontend to the
cron utilities. That said, if you can use a text
editor (such as any of those described in Chapter 23 or Chapter 24), you can set
up cron tasks for yourself or (if you have the
right credentials) the whole machine.
cron works courtesy of a clock-watching daemon
named
crond.
When this loads, it reads all
the
cron tables defined in some standard filesystem
locations that contain entries representing lists of times or
repeating intervals, with a Darwin command to execute for each entry.
On Mac OS X, these tables exist in two locations:
-
/etc/crontab This is the
crontable for the whole system. Each entry in this table represents a command that root runs at the given time. The file is world-readable, but only root may edit it.-
/var/cron/tabs/ This directory contains one file for each user on the machine who uses the
cronsystem. You actually don’t interact directly with these files (whose permissions prevent it anyway); you must use thecrontab -ecommand to edit your own file. You can’t read or change other users’crontables.
The cron tables’ format is tricky and hard to remember (unless you’re a system administrator who must update them regularly), ...
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