XJanitor.pl intelligently runs required maintenance tasks

Mar 20, '03 09:53:00AM

Contributed by: luhmann

If your Mac isn't on for 24 hours a day, every day, then your system maintenance scripts are not getting run in a timely manner. There are a number of solutions out there to work around this, but most require your active participation at some point. The free XJanitor.pl perl script, however, does not.

What Xjanitor does is at a specified interval (I use a quarter after the hour, each hour), it checks to see if the output logs of the periodic scripts have been updated within an appropriate time frame (daily, weekly, monthly). If not, it runs them. It is fairly easy to install, except for two things. One, you have to make the script executable. Secondly, you have to adjust the cron tab. The web site for the script tells you how to do both of these steps via the terminal.

However, I found that the cron-tab part could be done much easier via Cronnix, which has previously been mentioned on OSXhints. It is important, however, that the "user" for running this task be "system" and not "username" so that it runs as root. Otherwise, it won't have permissions.

[robg adds: We've run a couple hints (1, 2) discussing this before, but this one's different enough to merit a hint of its own. The intelligence of the script means that you won't have to "over-run" your weekly or monthly scripts just to make sure they're getting done. Since the maintenance tasks run at most 'daily,' I would think a cron task set up to check once per day would be sufficient to insure that all maintenance is being performed. Nice solution!]

Comments (16)


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