#!/bin/sh # folding at home cron script. # # Written by Michael A. Peters for # Team MacAddict4Life (Team 18) # # Put this script in your user account bin directory. # # On OS X that would probably be /Users/joe/bin if your username was joe. # # You may need to create it- # mkdir ~/bin # # Then add the following entry to your crontab (but w/o the # # # * * * * * cd /Users/joe/bin; sh startfolding.sh 2> /dev/null 1> /dev/null FOLDING_DIR1="/Users/resedit/FAH" FOLDING_DIR2="/Users/resedit/FAH-2" # change the FOLDING_DIR1 above to the directory where you installed folding. # If you have a 2 cpu machine, be sure to change the FOLDING_DIR2 as well. CLIENT="FAH2Console-v219-OSX.bin" # If using a *nix other than OS X you will want to change the CLIENT variable. # Also, a future version of the client for OS X may be different. CPUCOUNT=1 # If you have a dual cpu mac AND are running two instances of folding # then change the CPUCOUNT from 1 to 2 # ###### # # You should not need to edit anything beyond this point # unless you are lucky enough to have MORE than 2 cpus # ###### #if [ $1 -eq 1 ]; then # CPUCOUNT=1 # # lets us ignore second cpu if CPUCOUNT=2 # # and we don't want to start it #fi if [ `ps -waux |grep "$CLIENT" |grep -v "grep" |grep -c "$CLIENT"` -gt 0 ]; then # She's already running if [ ! -f /tmp/stopfold ]; then exit 0 else # user wants it dead for a in `ps -waux |grep "FAH2Console" |grep -v "grep" |awk '{print $2}'`; do kill -9 $a done; for a in `ps -waux |grep "Core_65\.exe" |grep -v "grep" |awk '{print $2}'`; do kill -9 $a done; fi else if [ ! -f /tmp/stopfold ]; then if [ $CPUCOUNT -eq 1 ]; then cd $FOLDING_DIR1 nohup ./$CLIENT 2> /dev/null 1> /dev/null & else cd $FOLDING_DIR1 nohup ./$CLIENT -local 2> /dev/null 1> /dev/null & cd $FOLDING_DIR2 nohup ./$CLIENT -local 2> /dev/null 1> /dev/null & fi exit fi fi # Changelog- # # March 21 2002 # # If /tmp/stopfold exists, it kills it and doesn't try to start it if not running. # March 23 2002 # # If the script is set up for two cpu machines but we only want to invoke one # then we can do so by just calling the script with an arguement of 1