Tuesday, July 17, 2007

Launchd

After some research, MacOS X has something called launchd to handle starting and stopping processes which control which daemon are enabled and how they are activated

$ launchctl list

com.google.Desktop.Daemon
com.google.Desktop.StatsUploader
com.google.filesystems.fusefs
com.apple.dashboard.advisory.fetch
com.apple.dnbobserverd
com.apple.KernelEventAgent
com.apple.mDNSResponder
com.apple.nibindd
com.apple.periodic-daily
com.apple.periodic-monthly
com.apple.periodic-weekly
com.apple.portmap
com.apple.syslogd
com.apple.usbmuxd
com.vix.cron
org.postfix.master
org.xinetd.xinetd

in /Library/LaunchDaemons there is:

$ ls /Library/LaunchDaemons/
com.google.Desktop.Daemon.plist com.google.filesystems.fusefs.pli st
com.google.Desktop.StatsUploader.plist

To disable the Google Desktop daemon for example:

launchctl unload -w /Library/LaunchDaemons/com.google.Desktop.*

I still however have a bunch of GoogleDesktopAgent processes (agent are daemons that run for a user) running:

$ ps -A | grep GoogleDesktopAgent
175 ?? S 0:01.89 /Library/Google/Google Desktop/GoogleDesktopAgent.app/Contents/MacOS/GoogleDesktopAgent -psn_0_1441793
177 ?? S 0:02.07 /Library/Google/Google Desktop/GoogleDesktopAgent.app/Contents/MacOS/GoogleDesktopAgent -asAgent YES
486 ?? S 0:01.43 /Library/Google/Google Desktop/GoogleDesktopAgent.app/Contents/MacOS/GoogleDesktopAgent -psn_0_10223617
488 ?? S 0:01.57 /Library/Google/Google Desktop/GoogleDesktopAgent.app/Contents/MacOS/GoogleDesktopAgent -asAgent YES

With fs_usage being much more quiet the computer hits over 5 hours with a full charge, but rapidly falls down to below 4:30 with light activity.

launchd would probably be the perfect entry point to add a mechanism to deal with "periodic" housekeeping tasks by delaying them when the computer is running on battery.

No comments: