Fixing the Default Housekeeping schedule



OS X has three housekeeping scripts that are run on a daily, weekly and monthly basis if your computer is left on early in the morning (between 3-6 am). These scripts are run by cron in the default /etc/crontab. Some GUI programs like MacJanitor and Cronathon can be used to run these scripts manually at any time. However, this is just a symtomatic cure to a very real problem: Apple engineers made a greviously erroneous assumption about when to schedule the housekeeping scripts, and for not providing a mechanism for rescheduling them or checking to see if they are being run at all. Their defaults are fine for a desktop machine that is left on 24 hours a day and set not to go to sleep (such as a server machine or for users with a desktop machine who have configured their Energy Saver settings in such a fashion).

However, for most laptop users, the default settings are unusable as the housekeeping scripts will never be run!

The settings can be fixed by downloading CronniX and editing the system crontab:

or by manually editing the system crontab:
cd /etc
sudo -s
cp crontab crontab.default
pico crontab

It will have three lines:
15 3 * * * root periodic daily
30 4 * * 6 root periodic weekly
30 5 1 * * root periodic monthly

We are interested especially in the second column of numbers, since they represent the hours at which the housekeeping scripts will run.

The asterisks represent that the daily script will run at "3:15 a.m. on every day of the month, on every month, and every day of the week," that is "every day at 3:15 a.m.". The weekly script runs at 4:30 a.m. on every weekday number 6 (Saturday). The monthly script runs at 5:30 a.m. on the first of each month.

I suggest editing it in a similar fashion to this:
15 8 * * * root periodic daily
30 9 * * 5 root periodic weekly
30 10 1 * * root periodic monthly

These settings will make all the scripts run during normal working hours, which is how they should be for most users. Once it is satisfactorily edited, type Ctrl + O to write out the file in pico, enter to accept the name, and Ctrl + X to exit.
to exit the root shell.

Shop Amazon

Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.