O'Reilly logo

Running Mac OS X Tiger by James Duncan Davidson, Jason Deraleau

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

cron

The primary tool for scheduling tasks on the command line is the venerable cron. This tool is started automatically by launchd (as required) and runs continuously in the background. When loaded, cron wakes up every minute to consult a set of tables to see if there is anything to be executed at that time. If so, it takes care of executing it. These tables, known as crontab files, are located in two places on the filesystem:

/etc/crontab

The crontab file for the system at large. Each entry in this table represents a command that will be run by the root user and the time that it will be run. Anybody can read this file, but only the root user can edit it. Starting in Tiger, most of the tasks that were once launched by cron have made their way to launchd. Thus, crontab is somewhat deprecated from Apple’s standpoint, but it’s still there if you want it.

Setting a repeating event in iCal to execute a script

Figure 13-2. Setting a repeating event in iCal to execute a script

/var/cron/tabs/

This directory contains the user crontab files for each user on the system who is using cron. These files are hidden and are visible only to the root user, so that other users on the system can’t look at each other’s crontab files.

The launchd daemon loads cron only if a crontab is set up on the system. In a default Tiger install, this means cron is not running at all. However, once you install a crontab for your user or make changes to the system crontab ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required