#!/bin/bash # # Script to run the BOINC client software at boot time. # (http://boinc.berkeley.edu) # # This script is aimed at those who wish to run BOINC # analysis as a command line operation without generating # any graphical output. Operations are run as root user, # so you should only use this on a system where you have # complete control, i.e. you are the SysAdmin. The script # is based on the init scripts for Red Hat/Fedora Core, # and has been tested on Fedora Core 3, 4, 5, 6 & 7. # # Check http://www.gaztronics.net/ for the # most up-to-date version of this script. # # This script is realeased under the terms of the GPL. # You can source a copy at: # http://www.fsf.org/copyleft/copyleft.html # # Please feel free to modify the script to suite your own needs. # I always welcome email feedback with suggestions for improvements. # Please do not email for general support. I do not have time to answer # personal help requests. # Author: Gary Myers MIIE MBCS CITP # email: http://www.gaztronics.net/webform/ # Revision 1.2 - 20th November 2007 # Updated for BOINC client 5.8.16_i686-pc-linux-gnu #==================================================================== # Run level information: # # chkconfig: 345 71 29 # description: Berkeley Open Infrastructure for Network Computing # processname: boinc # # Run "/sbin/chkconfig --add boinc" to add the Run levels. # This will setup the symlinks and set the process to run at boot. #==================================================================== #==================================================================== # Paths and variables and system checks. # Source function library (It's a Red Hat thing!) . /etc/rc.d/init.d/functions # Check that networking is up. # [ ${NETWORKING} ="yes" ] || exit 0 # Set the path for your BOINC client workspace. # This example runs from a subdirectory under /root. # BOINC_DIR=/root/BOINC # Check the BOINC_DIR exists if [ ! -d $BOINC_DIR ] ; then echo "The path to the BOINC directory does not exist!" exit 0 fi # Path to the lock file. # We only want one instance of BOINC running. # (BOINC creates it's own lock file - this is for insurance!) # LOCK_FILE=/var/lock/subsys/boinc # Path to the BOINC logfile directory. # LOGDIR=/var/log/BOINC # Check the logfile directory exists # and create it if it does not. if [ ! -d $LOGDIR ]; then mkdir $LOGDIR fi # Logfile names. # LOGFILE=$LOGDIR/boinc_log ERROR=$LOGDIR/error_log #==================================================================== #==================================================================== # Run controls: prog=$"BOINC" RETVAL=0 # Start BOINC running. # start() { if [ -f $LOCK_FILE ]; then echo "BOINC is already running!" exit 0 else echo -n $"Starting $prog: " cd $BOINC_DIR $BOINC_DIR/boinc >> $LOGFILE 2>> $ERROR & fi RETVAL=$? [ $RETVAL -eq 0 ] && success echo [ $RETVAL -eq 0 ] && touch $LOCK_FILE return $RETVAL } # Stop BOINC. # stop() { if [ ! -f $LOCK_FILE ]; then echo "BOINC is not running!" exit 0 else echo -n $"Shutting down $prog: " killproc boinc RETVAL=$? [ $RETVAL -eq 0 ] rm -f $LOCK_FILE; rm -f $BOINC_DIR/lockfile; echo return $RETVAL fi } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; condrestart) if [ -f $LOCK_FILE ]; then stop start RETVAL=$? fi ;; status) status boinc RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" RETVAL=1 esac exit $RETVAL