Mac OS X maintenance

      Comments Off on Mac OS X maintenance

A quick note to document setting up system maintenance scripts on Mac OS X (Tiger)—what I used to think of as cron jobs.

With Tiger, cron is still around and works fine but it is now “deprecated” as a piece of the wholesale reworking of process launching in Mac OS X. A good discussion of the differences between the old way (cron) and the new is found at MacDevCenter.

The following describes how I set up our MARS (DSpace) server to automagically re-index the content each day.

1) I wrote a small shell script that managed the reindexing (running the reindex job as appserver—the user who “owns” the DSpace installation)

2) I moved the script into /etc/periodic/daily

3) I renamed the script to 800.daily.MARSjobs

all files within the /etc/periodic/daily execute in order, based on the ### prefix (e.g., 100.daily executes before 200.daily)

4) I tested with this command (run as root): # periodic daily

this runs all the scripts in the /etc/periodic/daily directory.

Everything worked fine.

A couple of final points:

To see the output of these “periodic” jobs, check /var/log and the files daily.out, weekly.out and monthly.out
All jobs placed in the /etc/periodic directories run as root so it’s really only suitable for system maintenance tasks.

To run personal “cron” type jobs, you need to use launchd. Type man launchd.plist to get started on that topic.