#!/bin/sh # rc.boinc - BOINC startup script for Slackware Linux # # Installation: Edit the variables below to suit your BOINC setup. # Place this file in /etc/rc.d/ and make the file executable. # Add the following code to /etc/rc.d/rc.local: # # if [ -x /etc/rc.d/rc.boinc ]; then # /etc/rc.d/rc.boinc start # fi # # Start the BOINC client as root with ./etc/rc.d/rc.boinc. (The BOINC # client will start automatically on next reboot) # # # Author: Mark Hill www at markhill.me.uk # URL: # Licence: GPL v2 or later # Script ideas from Arrigo Marchiori's SuSe BOINC startup script: # # $Id: rc.boinc,v 1.4 2005/03/26 02:12:44 mark Exp mark $ # # This script is LSB 2.0.1 compliant where it is appropriate for Slackware # BOINC_DIR=/home/boinc/boinc/ BOINC_BIN=boinc_4.19_i686-pc-linux-gnu BOINC_USER=boinc BOINC_OPTIONS= #BOINC_OPTIONS="-update_prefs http://climateprediction.net/ -return_results_immediately" BOINC_LOGFILE=/home/boinc/boinc-log BOINC_ERRORFILE=/home/boinc/boinc-errors # End of user configuration #---------------------------------------------------------------------- boinc_status() { if (ps aux | grep $BOINC_BIN >/dev/null 2>&1); then return 0 else return 3 fi } boinc_start() { boinc_status; if [ $? = 0 ]; then echo "BOINC is already running" exit 1; fi if [ ! -d $BOINC_DIR ]; then echo "ERROR: $BOINC_DIR does not exist" exit 1; elif [ ! -x $BOINC_DIR$BOINC_BIN ]; then echo "ERROR: $BOINC_DIR$BOINC_BIN does not exist or not executable" exit 1; fi echo "Starting BOINC client" su - $BOINC_USER -c " cd $BOINC_DIR; exec ./$BOINC_BIN \ $BOINC_OPTIONS \ >$BOINC_LOGFILE 2>$BOINC_ERRORFILE" & # exec is used so the boinc program replaces the spawned bash shell, which # would otherwise be in the process table, wasting memory. } boinc_stop() { echo "Stopping BOINC client" killall $BOINC_BIN } boinc_restart() { echo "Restarting BOINC client" boinc_status; if [ $? = 0 ]; then boinc_stop sleep 3 boinc_start else boinc_start fi } case "$1" in start) boinc_start exit 0 ;; stop) boinc_stop exit 0 ;; restart) boinc_restart exit 0 ;; status) boinc_status if [ $? = 0 ]; then echo "BOINC is running" else echo "BOINC is not running" fi ;; force-reload) boinc_restart exit 0 ;; reload) echo "BOINC is unable to reload config without restart" echo "Try using $0 restart" exit 3 ;; *) echo "Usage: $0 start|stop|restart|reload|force-reload|status" exit 1 ;; esac