View | Details | Raw Unified
Collapse All | Expand All

(-) /usr/portage/app-sci/setiathome/files/seti-init.d-r1 (-20 / +18 lines)
 Lines 1-33    Link Here 
#!/sbin/runscript
#!/sbin/runscript
cpus=`egrep -c "^bogomips" /proc/cpuinfo`
[ -z "${SETIATHOME_THREADS}" ] && SETIATHOME_THREADS=`egrep -c "^bogomips" /proc/cpuinfo`
depend() { 
depend() { 
	need net
	need net
}
}
checkconfig() {
checkconfig() {
        if [ ! -e ${SETIATHOME_DIR} ]
        if [ ! -e "${SETIATHOME_DIR}" ]
        then
        then
                einfo "Creating ${SETIATHOME_DIR}"
                einfo "Creating ${SETIATHOME_DIR}"
                mkdir ${SETIATHOME_DIR}
                mkdir "${SETIATHOME_DIR}"
        fi
        fi
        if [ ! -e ${SETIATHOME_DIR}/user_info.sah ]
        if [ ! -e "${SETIATHOME_DIR}/user_info.sah" ]
        then
        then
                einfo "Setting up SETI@home for the first time"
                einfo "Setting up SETI@home for the first time"
                cd ${SETIATHOME_DIR}
                cd "${SETIATHOME_DIR}"
                ./setiathome -login
                /opt/setiathome/setiathome -login
        fi
        fi
        if [ $cpus != '1' ]; then
        if [ "${SETIATHOME_THREADS}" != '1' ]; then
                cd ${SETIATHOME_DIR}
                cd ${SETIATHOME_DIR}
                for cpu in `seq 2 $cpus`; do
                for thread in `seq 2 "${SETIATHOME_THREADS}"`; do
                        if [ ! -e ${SETIATHOME_DIR}/cpu${cpu} ]; then
                        if [ ! -e "${SETIATHOME_DIR}/thread${thread}" ]; then
                                mkdir ${SETIATHOME_DIR}/cpu${cpu}
                                mkdir "${SETIATHOME_DIR}/thread${thread}"
                                cp ${SETIATHOME_DIR}/* ${SETIATHOME_DIR}/cpu${cpu} > /dev/null
                                cp "${SETIATHOME_DIR}/user_info.sah" "${SETIATHOME_DIR}/thread${thread}"
                                rm ${SETIATHOME_DIR}/cpu${cpu}/*.sah > /dev/null
                                cp ${SETIATHOME_DIR}/user_info.sah ${SETIATHOME_DIR}/cpu${cpu}
                        fi
                        fi
                done
                done
        fi
        fi
 Lines 37-55    Link Here 
        checkconfig
        checkconfig
        if [ $cpus = '1' ]; then
        if [ "${SETIATHOME_THREADS}" = '1' ]; then
                ebegin "Starting SETI@home"
                ebegin "Starting SETI@home"
        else
        else
                ebegin "Starting SETI@home ($cpus processors)"
                ebegin "Starting SETI@home (${SETIATHOME_THREADS} threads)"
        fi
        fi
        for cpu in `seq 1 $cpus`; do
        for thread in `seq 1 "${SETIATHOME_THREADS}"`; do
                cd ${SETIATHOME_DIR}
                cd "${SETIATHOME_DIR}"
                if [ $cpu != '1' ]; then
                if [ "${thread}" != '1' ]; then
                        cd cpu${cpu}
                        cd "thread${thread}"
                fi
                fi
                ./setiathome ${SETIATHOME_OPTIONS} >&/dev/null&
                /opt/setiathome/setiathome ${SETIATHOME_OPTIONS} >&/dev/null&
        done
        done
        eend $?
        eend $?