#!/bin/sh # # Run SETI clients on cached work units # Ready for multiple CPU operation. Execute with one argument, # the CPU to operate: 0, 1, 2, ... etc. e.g.: # # RunCache 0 # # Execute multiple times for multiple CPUs, e.g.: # RunCache 0 >> run0.out 2>&1 & # RunCache 1 >> run1.out 2>&1 & # ... etc. # # Expects directory structure: # # $SETI_TOP/cache/$CPU/[00-15] # # Will create a symlink when running a WU: # $SETI_TOP/cpu$CPU -> $SETI_TOP/cache/$CPU/[00-15] # and therefore will always be running in: # $SETI_TOP/cpu$CPU # # Remembers where it is in a file: running.$CPU # so it can restart with that WU if interrupted # # Leaves the client exit code in a file run.exit in each directory. # # Will cycle through $MaxClients WUs, wrapping around to 00 if # necessary, then exit. (It wraps if started on something # other than 00) # 8 WUs are four days worth of work on a Pentium II 400 Mhz with # UnixWare 7 (Version 2.4 of the client) # # Use in conjuction with the scrip FetchCache to take care of the # transmission of results back to SETI@home, and pick up # new WUs. FetchCache can be run while this script is # working. # # This script came from: # http://setiathome.ssl.berkeley/RunCache # Used in concert with the script: # http://setiathome.ssl.berkeley/FetchCache # # The utility, jday, used below is a simple program that # prints out the julian date. This is useful for later calculations # to determine time between operations. The jday source # can be picked up via anonymous ftp from: # ftp://jday.sourceforge.net/pub/jday/jday-1.1.tar.gz # # Sun Jul 23 10:37:40 PDT 2000 - updated - Hiram # Tue Oct 5 16:14:43 PDT 1999 - Hiram # SETI_TOP=/a/seti # Set to the top of your cache directory structure CPU=$1 GRAF="" # # one client can run with -graphics, in this case CPU 0 # if [ "${CPU}" -eq 0 ]; then { GRAF="-graphics" } fi MaxClients=8 Paused="" # # Will run forever # while true do STARTTIME=`jday` if [ -f running.${CPU} ]; then { Start=`cat running.${CPU} 2> /dev/null` } else { Start="00" } fi Fini=0 i=$Start while [ $Fini -eq 0 ] do cd ${SETI_TOP} rm -f ${SETI_TOP}/cpu${CPU} ln -s ${SETI_TOP}/cache/${CPU}/$i ${SETI_TOP}/cpu${CPU} cd ${SETI_TOP}/cpu${CPU} if [ -f work_unit.sah ]; then { Paused="" WUName=`grep name= work_unit.sah | cut -d= -f2` echo "$WUName ${CPU}/$i "`date`" "`jday` echo $i > ${SETI_TOP}/running.${CPU} ${SETI_TOP}/cpu${CPU}/client -stop_after_process -proxy www.ocston.org:3128 ${GRAF} > ./run.exit echo $? >> run.exit if [ -f result.sah ]; then { CPUTIME=`grep cpu_time= result.sah 2> /dev/null` } else { CPUTIME="cpu_time=20000.0" } fi echo "$WUName ${CPU}/$i FINI $CPUTIME "`jday` } fi Next=`expr $i + 1` if [ "$Next" -ge "$MaxClients" ]; then { i="00" } else { i=`echo $Next | awk '{printf "%02d", $1}'` } fi if [ "$i" = "$Start" ]; then { Fini=1 Start="00" } fi done cd ${SETI_TOP} rm -f running.${CPU} ENDTIME=`jday` GT05=`echo $STARTTIME $ENDTIME | awk '{if(($2-$1)>0.3)print 1;else print 0}'` # # If we zipped through the above loop quickly, we have no WUs # to process, so sleep an hour and maybe someone in the meantime # will run the FetchCache script to upload all the results # and pick up some new WUs. Check each hour. # if [ "$GT05" -eq 0 ]; then { if [ -z "${Paused}" ]; then { echo "Waiting ${CPU}/xx - "`date`" "`jday` } fi Paused="Yes" sleep 3600 } fi done
Make your own free website on Tripod.com