diff options
Diffstat (limited to 'app-sci/setiathome/files')
-rw-r--r-- | app-sci/setiathome/files/seti-init.d-r1 | 67 |
1 files changed, 47 insertions, 20 deletions
diff --git a/app-sci/setiathome/files/seti-init.d-r1 b/app-sci/setiathome/files/seti-init.d-r1 index 8433e18bb2c0..e8f34956bfa6 100644 --- a/app-sci/setiathome/files/seti-init.d-r1 +++ b/app-sci/setiathome/files/seti-init.d-r1 @@ -1,31 +1,58 @@ #!/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 [ ! -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 + 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 - ebegin "Starting SETI@home" - cd ${SETIATHOME_DIR} - ./setiathome ${SETIATHOME_OPTIONS} >&/dev/null& - eend $? + eend $? } stop() { - ebegin "Stopping SETI@home" - killall setiathome - eend $? + ebegin "Stopping SETI@home" + killall setiathome + eend $? } |