5

There are regular maintenance tasks that can run daily, weekly, and monthly on mac OS. But what does each one do?

update: I don't mean the specific scripts per se, but what's the main idea behind the updates. In general what is this designed to do daily? Weekly? and so on.

2 Answers 2

10

Here's a summary of what the various scripts do. Note that the scripts have not changed much between versions of macOS; I compared them between El Capitan (10.11.6), High Sierra (10.13.6), Catalina (10.15.) and Big Sur (11.2.3), and the only change I noticed was that /etc/periodic/weekly/320.whatis vanished sometime between 10.11.6 and 10.13.6, although something else seems to have taken over its function.

The general goal of the scripts is to clean up things (like temp files) that otherwise would accumulate, check and record system status, and create/maintain various parts of the system.

As you'll see, almost all of them are pretty obsolete -- they relate to things that either aren't used much or don't exist in modern versions of macOS. The only one that I'd really consider relevant today is /etc/periodic/daily/110.clean-tmps, which (as the name suggests) cleans up temporary files. I suspect this is mostly because the periodic system was inherited from FreeBSD, and Apple tends to do cleanup/maintenance on their components differently, so most of these scripts are leftovers from when macOS (well, Mac OS X at the time) inherited this system from FreeBSD.

Note that all of these scripts load settings from /etc/defaults/periodic.conf, (and also /etc/periodic.conf and /etc/periodic.conf.local, but they don't exist by default).

Daily scripts:

  • 110.clean-tmps -- deletes old files in /tmp (actually /private/tmp). Note that this does not clean up /var/tmp (actually /private/var/tmp) or the temporary items under /var/folders (actually /private/var/folders); those directories are (intentionally) less temporary than /tmp.
  • 130.clean-msgs -- deletes old "system messages". This relates to the msgs command, which I doubt anyone has actually used on macOS. Ever. The modification time on this script (listed at the top) is 2000/09/14.
  • 140.clean-rwho -- deletes stale files in /var/rwho. This relates to the rwho command, about as relevant as msgs, script also dates from 2000/09/14.
  • 199.clean-fax -- deletes old fax scratch files in /var/spool/fax. I'm not even sure the feature that creates files there still exists in macOS.
  • 310.accounting -- rotates system accounting files in /var/account/acct, which relates to the ac command, which I again doubt anyone still uses. This script dates from 2001/05/30.
  • 400.status-disks -- checks how full the local disks are with df -h -l, but doesn't seem to do anything useful with the information. (It gets recorded in /var/log/daily.out, but who checks that?)
  • 420.status-network -- checks the status of the local network interfaces with netstat -i, but again the info just gets recorded in /var/log/daily.out.
  • 430.status-rwho -- seems to mostly just get the system's uptime (how long since last boot); again, it's recorded in /var/log/daily.out.
  • 999.local -- runs /etc/daily.local if it exists (it doesn't by default). This is for backward compatibility with an older organization of the periodic files that was obsolete when this script was written: 2001/06/01. Wow.

Weekly scripts:

  • 320.whatis -- this creates/updates a database of man pages for the whatis command to search. This script was removed sometime between 10.11.6 and 10.13.6, although the whatis command still exists and seems to work (I guess it's updated some other way now).
  • 999.local -- runs /etc/weekly.local if it exists. More extreme backward compatibility.

Monthly scripts:

  • 199.rotate-fax -- rotates old fax logs in /var/log/fax. Again, I'm not sure this feature exists anymore.
  • 200.accounting -- more to do with that system accounting system I don't think anyone still uses.
  • 999.local -- runs /etc/monthly.local if it exists. More extreme backward compatibility.
3

The scripts which get run are stored in /etc/periodic:

$ find /etc/periodic -type f
/etc/periodic/daily/199.clean-fax
/etc/periodic/daily/140.clean-rwho
/etc/periodic/daily/110.clean-tmps
/etc/periodic/daily/310.accounting
/etc/periodic/daily/420.status-network
/etc/periodic/daily/130.clean-msgs
/etc/periodic/daily/430.status-rwho
/etc/periodic/daily/999.local
/etc/periodic/daily/400.status-disks
/etc/periodic/monthly/199.rotate-fax
/etc/periodic/monthly/999.local
/etc/periodic/monthly/200.accounting
/etc/periodic/weekly/999.local

These are just text files containing shell commands and comments. You can look into all of them with less $(find /etc/periodic -type f).

2
  • This is a step in the right direction, although at least a summary of the functionality of these files would help to improve the answer. Commented Feb 10, 2021 at 22:37
  • 3
    @DylanKinnett The number of scripts may change anytime so anybody interested has to look into the directories anyway (that's why I've included the command used to list all of them).
    – nohillside
    Commented Feb 11, 2021 at 5:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .