Skip to Content
Mac OS X in a Nutshell
book

Mac OS X in a Nutshell

by Jason McIntosh, Chuck Toporek, Chris Stone
January 2003
Intermediate to advanced
832 pages
32h 40m
English
O'Reilly Media, Inc.
Content preview from Mac OS X in a Nutshell

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 does not 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 17), then 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 of the cron tables defined in some standard filesystem locations, which 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 cron table for the whole system. Each entry in this table represents a command that root will run 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 cron system. You actually don’t interact directly with these files (whose permissions prevent it anyway); you must use the crontab -e command to edit your own file. You cannot read or change other users’ cron tables.

The cron tables’ format is tricky and hard to remember (unless you’re a system administrator who must update ...

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.
Start your free trial

You might also like

Mac OS X Internals: A Systems Approach

Mac OS X Internals: A Systems Approach

Amit Singh
C++ In a Nutshell

C++ In a Nutshell

Ray Lischner
Linux Shell Scripting Cookbook - Third Edition

Linux Shell Scripting Cookbook - Third Edition

Clif Flynt, Sarath Lakshman, Shantanu Tushar
Optimized C++

Optimized C++

Kurt Guntheroth

Publisher Resources

ISBN: 0596003706Supplemental ContentCatalog PageErrata