Monday, July 2, 2007

Starting Folding@Home at login


Now that I have started running the Folding@Home clients, I figured that I might as well install it on the kid's iMac, so that when they turn it on it can do something useful in the unused CPU cycles.


The easiest thing to do, and what is recommended in the Folding@Home documentation is to add the command line app to the Login Items in the Account Preference Pane.  The problem with this is that Terminal launches and the output from the tool is piped to the newly opened console.


I wanted to find a solution that would silently run a tool, on login.





LoginWindow Manager will let you configure a script to run when a user logs into your computer.  I used this to launch the Folding@Home app.  Here is the shell script that I use:




#!/bin/tcsh -f
if ( $1 == "kids" ) then
su $1 -c "/Applications/Folding @ Home/fah5" &
endif
exit 0


It looks like Mac OS X launches this script a root, so I use su to make sure that the client gets run as the right user.