#! /usr/local/bin/bash # # seti rc type file to manage the seti background process # # Written by Ken Schumacher 16 Aug 1999 # # I expect $HOME points to my home directory WORKDIR="${HOME}/seti/current" SETIPROG="./setiathome" cd ${WORKDIR} test -f ${SETIPROG} || exit 2 # # See how we were called. # case "$1" in start) # Check if there is a lock file in place if [ ! -f lock.txt ]; then echo 'Starting SETI@Home background process: ' nohup ${SETIPROG} -nice 20 -email >/dev/null & else echo "Can't start SETI@Home. Lock file exists." echo 'Use "$0 unlock" to remove the lock file.' exit 1 fi ;; stop|unlock) if [ -x /sbin/pidof ]; then kill -TERM $(/sbin/pidof setiathome) rm -f lock.txt elif [ -x /sbin/killall ]; then killall -TERM setiathome rm -f lock.txt else echo "I don't know how to kill the client on this O/S" echo 'Lock file not removed.' fi ;; hold) if [ ! -f stop_after_send.txt ]; then touch stop_after_send.txt echo "The SETI@Home process will stop after sending this workunit." else echo "The 'stop_after_send.txt' file already exists" fi ;; release) if [ -f stop_after_send.txt ]; then rm stop_after_send.txt else echo "The 'stop_after_send.txt' file is not there to delete" fi if [ -f lock.txt ]; then rm lock.txt else echo "The 'lock.txt' file is not there to delete" fi ;; status|stat) if [ ! -f lock.txt ]; then "No lock file present." fi vp seti | grep -v 'seti status' if [ -f stop_after_send.txt ]; then echo "There is a 'stop_after_send.txt' file in place." fi grep prog state.txt ;; *) echo "Usage: seti {start|stop|status|hold|release}" exit 1 esac exit 0