Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Problem:

  • Occasionally, my Macbook becomes very slow after waking up from sleep
  • I open Activity Monitor and notice some processes like makewhatis are taking 100% CPU
  • I kill the process[es] and then everything works fine again

Questions:

  • My guess is that these processes are cron jobs. Is that correct?
  • Is it ok to kill them?
  • Is there a way to make this problem not happen?
  • Is this fixed on Snow Leopard?

I'm using Leopard (10.5.8) on a MacBook5,1

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

You're almost certainly seeing the effects of launchd starting the periodic daily, periodic weekly, and periodic monthly routine system maintenance jobs, which do things like roll the logs and delete unused temporary files. Those jobs usually run at 3 in the morning, but if your machine was asleep at that time, launchd starts them the next time your machine wakes up.

The job that probably runs the longest and slows the system the most with a lot of disk I/O is the weekly (3AM Saturday morning) makewhatis job, which updates the filename database used by the traditional Unix locate command (sorta like an old-school mds/Spotlight). You can disable this in /etc/defaults/periodic.conf by changing the line

weekly_whatis_enable="YES"

to

weekly_whatis_enable="NO"

If you've added or modified a large number of files on your system, the next time makewhatis runs, it may take a long time. If you kill it every time and it never completes, then the next week it'll have to start over again. I'm not usually bothered by makewhatis, even though my system is not fast, especially my disk. The only time I really notice it is when I've added a huge number of files to my system, like after checking out the entire source tree of the NetBSD operating system.

If makewhatis and the other periodic jobs don't turn out to be your whole problem, be aware that launchd provides the defer-to-the-next-wake service to any launchd job that uses the StartCalendarInterval key. Here's a way to quickly see which launchd jobs on your system use that key:

grep -r StartCalendarInterval {/System,,~}/Library/Launch{Daemons,Agents}/

(NB: I think the curly braces in that statement may be a bash-ism)

share|improve this answer
add comment

To see if they are cron jobs .... do a

crontab -l 

in Terminal

You'll most likely get

crontab: no crontab for (user)

most scheduled jobs are handled by launchd in 10.5 and up.

To check for scheduled jobs that are controlled by launchd, do a

sudo launchctl list 

If you see any of the jobs returning a 1 That is an indication it is having an issue.

share|improve this answer
1  
Of interest might be if these are enabled in /System/Library/LaunchDaemons: com.apple.locate.plist and com.vix.cron.plist –  Nerdling Apr 28 '10 at 11:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.