blog advertising is good for you


blog advertising is good for you
User login

Forcing Periodic Tasks

tarra asks:

Question

how do you permantely delete system.log archives…….it just grows and grows. ok, i’m new to this mac and can’t seem to find out how to do this. thank you.

Answer

This is a long-standing issue with “Unix on the desktop” — well, specifically, “Unix on the portable” — because the nightly cleanup tasks rarely get run because the unit is asleep. This has been around since Mac OS X 10.0 and exists through 10.4. The tasks are scheduled as follows:

  • Daily, 3:15a:
    • Cleans some log files (/etc/periodic/daily/110.clean-logs)
    • Removes scratch, temp, and “junk” files (/etc/periodic/daily/500.daily)
    • Rotates log files (/etc/periodic/daily/500.daily)
    • Prunes some log files (/etc/periodic/daily/500.daily)
    • Runs any local additions (/etc/daily.local)
  • Weekly, 4:15a:
    • Updates the locate database (/etc/periodic/weekly/500.weekly)
    • Updates the whatis database (/etc/periodic/weekly/500.weekly)
    • Further rotates some longer-term log files (/etc/periodic/weekly/500.weekly)
    • On Server, rotates web log files (/etc/periodic/weekly/500.weekly)
    • Runs any local additions (/etc/weekly.local)
  • Monthly, 5:15a:
    • Performs login accounting with ac (/etc/periodic/monthly/500.monthly)
    • Rotates even more long-term log files like wtmp and fax.log (/etc/periodic/monthly/500.monthly)
    • Runs any local additions (/etc/monthly.local)

To manually run any of these batches, run the appropriate command:

$ sudo periodic daily
$ sudo periodic weekly
$ sudo periodic monthly

alt="periodic-macjanitor" title="periodic-macjanitor" longdesc="" class="right" />
alt=”periodic-macjanitor” title=”periodic-macjanitor” longdesc=”” class=”right” />

There are several programs out there that will do this for you. A freebie is MacJanitor but MacUpdate or VersionTracker will have some more. Just search on “periodic” to see them.

Of course, you can do this, or you can change the programs to run when the computer is in use (if you can predict that). In Tiger these are started by launchd files in /System/Library/LaunchDaemons/com.apple.periodic.[name].plist. Go into those files and edit them so that they run at an earlier time.

In Panther and earlier, the periodic scripts are run from cron. Edit the respective line in /etc/crontab to change the time for the right file. If you’re not a cron user, Cronnix will let you edit it in the GUI (File->Open System Crontab).

Average rating
(0 votes)
About Adam Knight
Adam Knight's picture

Author Biography

Adam Knight is one of the founders of Mac Geekery and is a geek at heart. Programmer by day, hacker by night, his daily life revolves around the Macintosh platform, which he has been a user and programmer for since the early days of System 7 when his LCII replaced his Apple //c.

In-between tech jobs, he’s managed to learn the basics of any web hacker: PHP, MySQL, Perl, Apache, Linux, *BSD, and the intricacies of ./configure —prefix=~/bombshelter/. Today, codepoet is concentrating on blogging again, writing some software for the Mac by himself (including Notae) and for his company (such as Switchblade) and has a few other toys coming out soon.

Bug him over AIM or email [link fixed].

Because I’ve been in the UNIX world for so long, I’ve had 4 laptops running Linux as either the primary or only OS. Anacron was wonderful for handlinig cron jobs that should have run, but didn’t because the system was off, sleeping, or booted to another OS. Luckily, Anacron has been ported to OSX, and now uses launchd no less. It was one of first things I looked for after switching to OS X.

Apple’s Mac OS X software page has an entry for Anacron

Adam Knight's picture

I’ve not run a single Linux station as anything but 24/7 so I’d never had cause to come across that. That’s a pretty nifty package.

Yeah,
but I am experiencing the opposite.
When I ‘stay’ over tonight,
I really DON’T want it to run other than manually on my behalf when I want it.
I hate the rattling sound of activity I have no control of.

How to completely disable the crontasks to be run?
I want to run them manually or not to be run at all.
and is there an app that can permanently disable any system crontask to run?
Because with an app like Macaroni; even when I set the parameters in Macaroni to non existing date and time
the 32th of a month for example,
it still does run the jobs whenever it feels like some need for them to be run.

HOW… can I permanently disable any system crontask?

Sanne

Adam Knight's picture

Kill cron. It’s a launchd task in /System/Library/LaunchDaemons.

I don’t recommend it, and you’ll have problems, but have fun. Smiling

Post new comment
The content of this field is kept private and will not be shown publicly.
8 + 8 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.