Edit crontab for basic utilities in a business setting

Feb 11, '05 09:41:00AM

Contributed by: thornezilla

Despite the handiness of Cronnix and other utils, I find that several factors promote the editing of crontab files for use in corporate settings:

  1. Freeware or shareware is often discouraged.
  2. Potential conflicts with other apps, utils or OS X upgrades is higher with free/shareware apps than with crontab running additional diskutil or plutil jobs.
  3. Without running a scheduler like iBeezz that will wake systems up and run specific jobs, sleeping systems will wake and run utils at the worst time for users -- when they are trying to start work.
So here's a sample crontab that changes the daily, weekly, and monthly jobs to run at a time when systems are (hopefully) not asleep (our builds wait three hours before they sleep). repairPermissions is run weekly, as is plutil's preferences check both for User and System-level prefs. I'm no UNIX guru so feel free to correct any errors, but this crontab runs well on 100+ production OS 10.3.3-5 systems.
# /etc/crontab
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute  hour  mday  month  wday  who  command
#
#*/5  *  *  *  *  root  /usr/libexec/atrun
#
# Run daily/weekly/monthly jobs.
# Modified by YOURNAMEHERE for XCORP, DATE. 
# Adds weekly Repair Permissions plus reschedules periodic jobs
# for times when systems are running and awake.
# Adds weekly prefs scan, -s reports only corrupt prefs.
15  17  *  *  *  root  periodic daily
30  9   *  *  2  root  periodic weekly
30  10  1  *  *  root  periodic monthly
15  18  *  *  3  root  diskutil repairPermissions /
15  16  *  *  4  root  plutil -s ~/Library/Preferences/*.plist
30  16  *  *  4  root  plutil -s /Library/Preferences/*.plist
[robg adds: I haven't tested this one, but I do understand the business perspective -- untested external tools aren't particularly welcome at my office, either! If you try this, you'll want to use tabs between the items in the crontab list; they're spaces here to make it a bit narrower.]

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=200502082215230