I have modified the setiathome init script to launch multiple processes on machines with more than one CPU. It deduces CPU count at runtime from /proc/cpuinfo and shouldn't act differently than the current one when only one CPU is present. I've not tested it on a single-CPU machine (as I don't have one readily available) but I am confident it will function properly. The contents of my /etc/init.d/setiathome follows. --- #!/sbin/runscript cpus=`grep -c processor /proc/cpuinfo` checkconfig() { if [ ! -e ${SETIATHOME_DIR} ] then einfo "Creating ${SETIATHOME_DIR}" mkdir ${SETIATHOME_DIR} fi if [ ! -e ${SETIATHOME_DIR}/user_info.sah ] then einfo "Setting up SETI@home for the first time" cd ${SETIATHOME_DIR} ./setiathome -login fi if [ $cpus != '1' ]; then cd ${SETIATHOME_DIR} for cpu in `seq 2 $cpus`; do if [ ! -e ${SETIATHOME_DIR}/cpu${cpu} ]; then mkdir ${SETIATHOME_DIR}/cpu${cpu} cp ${SETIATHOME_DIR}/* ${SETIATHOME_DIR}/cpu${cpu} > /dev/null rm ${SETIATHOME_DIR}/cpu${cpu}/*.sah > /dev/null cp ${SETIATHOME_DIR}/user_info.sah ${SETIATHOME_DIR}/cpu${cpu} fi done fi } start() { checkconfig if [ $cpus = '1' ]; then ebegin "Starting SETI@home" else ebegin "Starting SETI@home ($cpus processors)" fi for cpu in `seq 1 $cpus`; do cd ${SETIATHOME_DIR} if [ $cpu != '1' ]; then cd cpu${cpu} fi ./setiathome ${SETIATHOME_OPTIONS} >&/dev/null& done eend $? } stop() { ebegin "Stopping SETI@home" killall setiathome eend $? }
Commited, thanks for the contribution!
Dang. I could have sworn I added a comment with changes to fix a couple potential upgrade issues (with new executables not being propagated, etc.) Here's a handmade pseudo-diff: if [ $cpus != '1' ]; then cd ${SETIATHOME_DIR} for cpu in `seq 2 $cpus`; do if [ ! -e ${SETIATHOME_DIR}/cpu${cpu} ]; then mkdir ${SETIATHOME_DIR}/cpu${cpu} - cp ${SETIATHOME_DIR}/* ${SETIATHOME_DIR}/cpu${cpu} > /dev/null - rm ${SETIATHOME_DIR}/cpu${cpu}/*.sah > /dev/null cp ${SETIATHOME_DIR}/user_info.sah${SETIATHOME_DIR}/cpu${cpu} fi done fi ... for cpu in `seq 1 $cpus`; do cd ${SETIATHOME_DIR} if [ $cpu != '1' ]; then cd cpu${cpu} fi ${SETIATHOME_DIR}/setiathome ${SETIATHOME_OPTIONS} >&/dev/null& done
aliz: i'm gonna go ahead and steal this cause i got 2 other seti@home bugs that involve rewriting the current setup ...
grep -c processor /proc/cpuinfo 0 This setup is borked in PPC I have no ideas on how to fix this. In PPC you get cat /proc/cpuinfo cpu : 740/750 temperature : 20-24 C (uncalibrated) clock : 400MHz revision : 130.1 (pvr 0008 8201) bogomips : 796.26 machine : PowerMac1,1 motherboard : PowerMac1,1 MacRISC Power Macintosh detected as : 66 (Blue&White G3) pmac flags : 00000000 L2 cache : 1024K unified memory : 512MB pmac-generation : NewWorld
Change cpus=`grep -c processor /proc/cpuinfo` to cpus=`grep -c bogomips /proc/cpuinfo` This should work on both platforms.
took some stuff from here =)