Zde je opravený skript pro zapnutí služby boinc na linuxu:
Postup je takový, že nejdřív vytvoříš uživatele boinc, potom se šupneš do jeho skupiny(boinc) a pak to všechno ostatní jak bylo rečeno výše.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#!/bin/sh
#
# BOINC - start and stop the BOINC client daemon on Unix
#
# Unix start/stop script to run the BOINC client as a daemon at
# system startup, as the 'boinc' user (not root!).
#
# This version works on Red Hat Linux, Fedora Core, Mandrake,
# and Slackware Linux, and should work on generic Linux systems
# provided they have 'pidof'. Metadata for chkconfig and the SUSE
# equivalent INIT info are included below.
#
# Usage: boinc { start | stop | status | restart }
#
###
# chkconfig: 345 71 29
# description: This script starts the local BOINC client as a daemon
# For more information about BOINC (the Berkeley Open Infrastructure
# for Network Computing) see
http://boinc.ssl.berkeley.edu
# processname: boinc
# config: /etc/sysconfig/boinc
#
### BEGIN INIT INFO
# Provides: boinc
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Description: This script starts the local BOINC client as a daemon
# For more information about BOINC (the Berkeley Open Infrastructure
# for Network Computing) see
http://boinc.ssl.berkeley.edu
### END INIT INFO
#
# Eric Myers <
myers@vassar.edu> - 27 July 2004
# Department of Physics and Astronomy, Vassar College, Poughkeepsie NY
# @(#) $Id: boinc,v 2.4 2005/05/24 14:00:07 myers Exp $
########################################################################
# Defaults, which can be overridden by /etc/sysconfig/boinc
BOINCUSER=boinc
BOINCDIR=/home/BOINC/
BUILD_ARCH=i686-pc-linux-gnu
# Log and error files (you should rotate these occasionally)
LOGFILE=boinc.log
ERRORLOG=error.log
# Mandrake 10.1 really wants a lock file...
LOCKDIR=/var/lock/subsys
# BOINC options:
#BOINCOPTS="-allow_remote_gui_rpc" # opens up your machine to the world!
BOINCOPTS="--daemon -allow_remote_gui_rpc" # Zde je nutné mít volbu --daemon a ne co tam bylo předtím
# Just set the path to what is needed, nothing more (for security)
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
# Init script function library. This stuff is Red Hat specific,
# but if the functions are not found we create our own simple replacements.
# (The idea for replacing the functions comes from OpenAFS. Thanks guys!)
if [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
function echo_success () { echo -n " [ OK ] " ; }
function echo_failure () { echo -n " [FAILED] " ; }
function echo_warning () { echo -n " [WARNING] " ; }
function killproc() {
PID=`pidof -s -x -o $$ -o $PPID -o %PPID $1`
[ $PID ] && kill $PID ; }
fi
# su on Linux seems to need this to be set to work properly
export TERM dumb
# Look for any local configuration settings:
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 7
fi
## Locate the executable, either boinc_client,
## or boinc with highest version number
BOINCEXE=$BOINCDIR/boinc
if [ ! -x $BOINCEXE ]; then
BOINCEXE=`/bin/ls -1 $BOINCDIR/boinc_*_ $BUILD_ARCH 2>/dev/null | tail -1 `
fi
if [ ! -x "$BOINCEXE" ]; then
echo "Cannot find/run BOINC executable. $BOINCEXE "
exit 2
fi
## Functions: $1 is start/stop/status/restart
case "$1" in
start)
cd $BOINCDIR
if [ -f lockfile ] ; then
echo -n "Another instance of BOINC is running (lockfile exists)."
echo_failure
echo
exit 4
fi
if [ ! -f client_state.xml ] ; then
echo -n "The BOINC client requires initialization."
echo_warning
echo
fi
echo -n "Starting BOINC client as a daemon: "
chown -R boinc:boinc boinc
su $BOINCUSER -c "$BOINCEXE $BOINCOPTS" >>$LOGFILE 2>>$ERRORLOG &
sleep 1
PID=`pidof -s -x -o $$ -o $PPID -o %PPID $BOINCEXE`
if [ $PID ]; then
touch $LOCKDIR/boinc
echo_success
else
echo_failure
fi
echo
;;
stop)
cd $BOINCDIR
if [ ! -f lockfile -a ! -f $LOCKDIR/boinc ] ; then
echo -n "BOINC is not running (no lockfile found)."
echo_success
else
echo -n "Stopping BOINC client daemon: "
killproc $BOINCEXE && echo_success || echo_failure
# clean up in any case
rm -f $BOINCDIR/lockfile
rm -f $LOCKDIR/boinc
fi
echo
;;
restart)
$0 stop
$0 start
;;
status)
PID=`pidof -x -o $$ -o $PPID -o %PPID boinc_client`
if [ "$PID" == "" ]; then
PID=`pidof -x -o $$ -o $PPID -o %PPID $BOINCEXE`
fi
if [ "$PID" != "" ]; then
echo "BOINC client is running (pid $PID)."
else
if [ -f $BOINCDIR/lockfile -o -f $LOCKDIR/boinc ]; then
echo "BOINC is stopped but lockfile exists."
else
echo "BOINC client is stopped."
fi
fi
;;
*)
echo "Usage: boinc {start|stop|restart|status}"
exit 1
esac
exit
#EOF#