Mac OS X maintenance 

The latest relase of MacJanitor gave me the incentive to write this entry.

Many people don't, won't or can't, leave their Mac turned on all the time, simply because they own a portable or a laptop, or because they have the habit of turning it off after they've finished using it.

All this was okay before Mac OS X arrived. Unix subsystems were originally designed to never be turned off. Hence, a number of system related maintenance tasks take place in the middle of the night between 3 and 5am when the workload is supposed to be minimal. These tasks are are scheduled to run on a daily, weekly and monthly basis.

Chances are that a majority of users have never let these tasks complete simply because they were unaware of them. Macjanitor addresses this problem be letting you launch the maintenance task when it suits you.

Let's take a closer look at what they involve.

Daily tasks
  • Clear out old files and directories
  • Remove system messages older than 21 days
  • If system accounting is on, process the accounting files and gather daily statistics
  • Backup the NetInfo database
  • Output the disk capacities and storage available
  • Show which filesystems haven't had 'dump' performed on them in a while (archaic)
  • Show accumulated network statistics and network uptime (ruptime)
  • Rotate the system.log file and restart the syslog process
  • Clear out the webserver log files older than a week
  • Run a /etc/security check script if it exists
Weekly tasks
  • If the /usr/libexec/locate.updatedb database exists, update the 'locate' database
  • If the /usr/libexec/makewhatis.local file exists, rebuilt the 'whatis' database
  • Rotate the following log files: ftp.log, lookupd.log, lpr.log, mail.log, netinfo.log
  • Restart the syslog process
Monthly tasks
  • Run the login accounting process
  • Rotate the wtmp log files
  • Restart the syslog daemon
If these maintenance tasks are never run (such as on a laptop that is always shut off at night), many log files and system databases will grow extremely large or fail to get backed up. The NetInfo database contains critical user information, and should be backed up now and then.

A solution would be to change the hours at which these tasks are scheduled to run to more civilized timeframe, say 11:00 or 12:00am. This involves launching the Terminal.app and editing the system crontab located in /etc/crontab
[jaya:/etc] root# more crontab
# /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.
15      3       *       *       *       root    periodic daily
30      4       *       *       6       root    periodic weekly
30      5       1       *       *       root    periodic monthly
[jaya:/etc] root#
Here you see that the daily tasks are set to run at 3:15am. Change it to
15     11       *       *       *       root    periodic daily
and they'll run at 11:15am. Or just use MacJanitor to launch them when you think of it. Note that running the scripts too often won't hurt your system, and running it for the forst time might take some time..

Posted a response ? — Webmention it

This site uses webmentions. If you've posted a response and need to manually notify me, you can enter the URL of your response below.

Want more ? — prev/next entries