#!/sbin/runscript # # Gentoo Linux start/stop script to run the BOINC client as a daemon # at system startup, as the boinc user (not root). # # chkconfig: 345 71 29 # description: start boinc client at boot time # processname: boinc # config: /etc/sysconfig/boinc # # Gabor Nagy - 18 January 2005 # # Based on the original Redhat Linux start/stop scrip by: # Eric Myers - 27 July 2004 # Department of Physics and Astronomy, Vassar College, Poughkeepsie NY # @(#) $Revision: 1.5 $ -- $Date: 2004/07/27 14:43:24 $ #PATH=/sbin:/bin:/usr/sbin:/usr/bin #export PATH # Source function library. #. /etc/rc.d/init.d/functions # Defaults, which can be overridden by /etc/sysconfig/boinc BOINCUSER=boinc BOINCDIR=/home/boinc BUILD_ARCH=i686-pc-linux-gnu LOGFILE=boinc.log ERRORLOG=error.log #BOINCOPTS="-allow_remote_gui_rpc" BOINCOPTS= if [ -f /etc/sysconfig/boinc ]; then . /etc/sysconfig/boinc fi ## Locate the working directory if [ ! -d $BOINCDIR ]; then echo "Cannot find boinc directory $BOINCDIR " exit 1 fi ## Locate the executable with highest version BOINCEXE=`/bin/ls -1 $BOINCDIR/boinc_*_$BUILD_ARCH 2>/dev/null | tail -n 1 ` if [ ! -x "$BOINCEXE" ]; then echo "Cannot find/run boinc executable $BOINCEXE " exit 2 fi ## Functions: start/stop/status/restart checkconfig() { cd $BOINCDIR if [ ! -f client_state.xml ] ; then eerror "BOINC client requires initialization first." return 1 fi } start() { checkconfig || return 1 ebegin "Starting BOINC client as a daemon: " start-stop-daemon --start --quiet --chuid $BOINCUSER --exec $BOINCEXE -- $BOINCOPTS >>$BOINCDIR/$LOGFILE 2>>$BOINCDIR/$ERRORLOG & eend $? } stop() { ebegin "Stopping boinc client daemon" start-stop-daemon --stop --quiet --retry 20 --exec $BOINCEXE eend $? } restart() { $0 stop $0 start eend $? }