Deploying BOINC

Message boards : BOINC client : Deploying BOINC
Message board moderation

To post messages, you must log in.

AuthorMessage
Augustine
Avatar

Send message
Joined: 10 Mar 06
Posts: 72
Message 3565 - Posted: 20 Mar 2006, 21:15:40 UTC
Last modified: 20 Mar 2006, 21:16:34 UTC

I'm sure I'm not the first one to share such information, but I hope that will help some out there.

This script, is installed at /etc/init.d and then "chkconfig --add boinc" must be executed to enable starting the client at every reboot. Run "/etc/init.d/boinc start" to start it manually for the first time.


#!/bin/bash
#
# BOINC init and deployment script
#
###
#
# For RedHat systems...
#
# chkconfig: 35 90 10
# description: BOINC client
#
###
#
# For LSB systems...
#
### BEGIN INIT INFO
# Provides: boinc
# Required-Start: $network $named $remote_fs
# Should-Start: $syslog $time ypbind ypclient
# Required-Stop: $network
# Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: BOINC client
### END INIT INFO

BOINC_USER=<username>
BOINC_SRC=/home/${BOINC_USER}/boinc # source directory for client program and accounts
BOINC_EXE=$(readlink -f "${BOINC_SRC}/boinc-`uname -i`-`uname -s`") # link to client program
# ${BOINC_SRC}/boinc/boinc_5.2.15_x86_64-unknown-linux-gnu # or client program
BOINC_DIR="/tmp/boinc" # client program run directory
BOINC_PARAMS="-allow_remote_gui_rpc -check_all_logins" # client program options

test -n "${DEBUG}" && BOINC_PARAMS="${BOINC_PARAMS} -redirectio" # show debug messages

KILL=killall # used to pause or resume client

test -x ${BOINC_EXE} || echo "${BOINC_EXE} does not exist or is not executable." >&2 && exit 1

case "$1" in
install)
## set up run directory and accounts
## create run directory
test -d ${BOINC_DIR} || su -c "mkdir -p ${BOINC_DIR} && chown ${BOINC_USER} ${BOINC_DIR}" ${BOINC_USER}
## create blank authorization file
test -e ${BOINC_DIR}/gui_rpc_auth.cfg || su -c "touch ${BOINC_DIR}/gui_rpc_auth.cfg" ${BOINC_USER}
## copy account files
for F in ${BOINC_SRC}/account_*.xml; do
cp -pu $F ${BOINC_DIR}
done
;;
sync)
## sync up account files
for F in ${BOINC_DIR}/account_*.xml; do
cp -pu $F ${BOINC_SRC}
done
;;
start)
echo "Starting Boinc..."
$0 install
cd ${BOINC_DIR}
su ${BOINC_USER} -c "${BOINC_EXE} ${BOINC_PARAMS} >/dev/null 2>&1 &"
;;
stop)
echo "Stopping Boinc..."
# cd ${BOINC_DIR}
# su $BOINC_USER -c "${BOINC_EXE}"
$0 pause
$KILL -g "${BOINC_EXE}"
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
## Sometimes boinc needs some time to stop
sleep 3
$0 start
;;
pause)
## Pause the service.
## Use "resume" to resume it.
$KILL -STOP -g "${BOINC_EXE}"
$KILL -CONT "${BOINC_EXE}"
;;
resume)
## Resume the service
$KILL -CONT -g "${BOINC_EXE}"
;;
*)
echo "Usage: $0 {start|stop|restart|pause|resume|install|sync}"
exit 1
esac




It makes several assumptions, though:
- the client program is at the user's home directory.
- the client program can be a link in the form "boinc_<hardware>_<platform>", making upgrades smoother.
- the account files are at the user's home directory.

HTH

ID: 3565 · Report as offensive
Augustine
Avatar

Send message
Joined: 10 Mar 06
Posts: 72
Message 5545 - Posted: 5 Sep 2006, 23:51:50 UTC
Last modified: 5 Sep 2006, 23:53:22 UTC

Updated script using AMS instead of separate account files.

Enjoy!

#!/bin/bash
#
# BOINC init and deployment script
#
###
#
# For RedHat systems...
#
# chkconfig: 35 90 10
# description: BOINC client
#
###
#
# For LSB systems...
#
### BEGIN INIT INFO
# Provides: boinc
# Required-Start: $network $named $remote_fs
# Should-Start: $syslog $time ypbind ypclient
# Required-Stop: $network
# Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: BOINC client
### END INIT INFO

BOINC=boinc
BOINC_USER=[i]username[/i]
BOINC_SRC=/home/${BOINC_USER}/boinc ## source directory for client program and accounts
BOINC_EXE=$(readlink -f "${BOINC_SRC}/boinc-`uname -i`-`uname -s`") ## link to client program
# BOINC_EXE=${BOINC_SRC}/boinc_5.6.0_x86_64-pc-linux-gnu ## or client program
BOINC_DIR="/tmp/boinc" ## client program run directory
BOINC_PARAMS="-allow_remote_gui_rpc -check_all_logins -daemon" ## client program options

test -n "${DEBUG}" && BOINC_PARAMS="${BOINC_PARAMS} -redirectio" ## show debug messages

KILL=killall ## used to pause or resume client

test -x ${BOINC_EXE} || ( echo "${BOINC_EXE} does not exist or is not executable." >&2 && exit 1 )

case "$1" in
    install)
        ## set up run directory and accounts
        test -n "${DEBUG}" && echo "Creating run directory..."
        test -d ${BOINC_DIR} || su -c "mkdir -p ${BOINC_DIR} && chown ${BOINC_USER} ${BOINC_DIR}" ${BOINC_USER} && test -n "${DEBUG}" && echo "... done."
        test -n "${DEBUG}" && echo "Copying client..."
        test -d ${BOINC_DIR} && su -c "cp -pu ${BOINC_EXE} ${BOINC_DIR}/${BOINC}" && test -n "${DEBUG}" && echo "... done."
        test -n "${DEBUG}" && echo "Creating blank authorization file..."
        test -e ${BOINC_DIR}/gui_rpc_auth.cfg || su -c "touch ${BOINC_DIR}/gui_rpc_auth.cfg" ${BOINC_USER} && test -n "${DEBUG}" && echo "... done."
        test -n "${DEBUG}" && echo "Copying BAM files..."
        for F in ${BOINC_SRC}/acct_mgr_login.xml ${BOINC_SRC}/acct_mgr_url.xml; do
                test -s $F && cp -pu $F ${BOINC_DIR}
        done
        test -n "${DEBUG}" && echo "... done."
        ;;
    sync)
        test -n "${DEBUG}" && echo "Syncing up AMS files..."
        for F in ${BOINC_DIR}/acct_mgr_login.xml ${BOINC_SRC}/acct_mgr_url.xml; do
                cp -p $F ${BOINC_SRC}
        done
        test -n "${DEBUG}" && echo "... done."
        ;;
    start)
        echo "Starting Boinc..."
        $0 install
        cd ${BOINC_DIR}
        su ${BOINC_USER} -c "${BOINC_DIR}/${BOINC} ${BOINC_PARAMS} >/dev/null 2>&1 &" && test -n "${DEBUG}" && echo "... done."
        ;;
    stop)
        echo "Stopping Boinc..."
        # cd ${BOINC_DIR}
        # su $BOINC_USER -c "${BOINC}"
        $0 pause
        $KILL -g "${BOINC_DIR}/${BOINC}" && test -n "${DEBUG}" && echo "... done."
        ;;
    restart)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        ## Sometimes boinc needs some time to stop
        sleep 30
        $0 start
        ;;
    pause)
        test -n "${DEBUG}" && echo "Pausing Boinc..."
        ## Use "resume" to resume it.
        $KILL -STOP -g "${BOINC_DIR}/${BOINC}" && $KILL -CONT "${BOINC}" && test -n "${DEBUG}" && echo "... done."
        ;;
    resume)
        test -n "${DEBUG}" && echo "Resuming Boinc..."
        $KILL -CONT -g "${BOINC_DIR}/${BOINC}" &&  test -n "${DEBUG}" && echo "... done."
        ;;
    *)
        echo "Usage: $(basename $0) {start|stop|restart|pause|resume|install|sync}"
        exit 1
esac


ID: 5545 · Report as offensive
michalsx

Send message
Joined: 17 Oct 06
Posts: 6
Czech Republic
Message 6057 - Posted: 17 Oct 2006, 20:44:19 UTC - in response to Message 3565.  

Just visit this place! It is much more easy way to do this.

http://www.thelazyslug.com/boinc.htm
ID: 6057 · Report as offensive
Augustine
Avatar

Send message
Joined: 10 Mar 06
Posts: 72
Message 7813 - Posted: 25 Jan 2007, 23:42:46 UTC
Last modified: 26 Jan 2007, 0:20:14 UTC

I added a couple of "ulimit" statements to safe-guard the system ("ulimit -v") and to allow some applications with huge stack requirements ("ulimit -s").

#!/bin/bash
#
# BOINC init and deployment script
#
# Copy to "/etc/init.d", run "chmod +x /etc/init.d/boinc" followed by 
# "chkconfig --add boinc" and then run "/etc/init.d/boinc" to start it.
#
###
#
# For RedHat systems...
#
# chkconfig: 35 90 10
# description: BOINC client
#
###
#
# For LSB systems...
#
### BEGIN INIT INFO
# Provides: boinc
# Required-Start: $network $named $remote_fs 
# Should-Start: $syslog $time ypbind ypclient
# Required-Stop: $network
# Should-Stop: 
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: BOINC client
### END INIT INFO

BOINC=boinc
BOINC_USER=guest ## BOINC username
BOINC_SRC=/home/${BOINC_USER}/boinc ## source directory for client program and accounts
BOINC_EXE=$(readlink -f "${BOINC_SRC}/boinc-`uname -i`-`uname -s`") ## link to client program
# BOINC_EXE=${BOINC_SRC}/boinc_5.4.11_x86_64-pc-linux-gnu ## or client program
BOINC_DIR="/tmp/${BOINC}" ## client program run directory
BOINC_PARAMS="-allow_remote_gui_rpc -check_all_logins -daemon" ## client program options
BOINC_MEM=1048576 ## maximum virtual memory allowed

test -n "${DEBUG}" && BOINC_PARAMS="${BOINC_PARAMS} -redirectio" ## show debug messages

KILL=killall ## used to pause or resume client
 
test -x ${BOINC_EXE} || ( echo "${BOINC_EXE} does not exist or is not executable." >&2 && exit 1 )

case "$1" in
    install)
	## set up run directory and accounts
	test -n "${DEBUG}" && echo "Creating run directory..."
	test -d ${BOINC_DIR} || su -c "mkdir -p ${BOINC_DIR} && chown ${BOINC_USER} ${BOINC_DIR}" ${BOINC_USER} && test -n "${DEBUG}" && echo "... done."
	test -n "${DEBUG}" && echo "Copying client..."
	test -d ${BOINC_DIR} && su -c "cp -p ${BOINC_EXE} ${BOINC_DIR}/${BOINC}" && test -n "${DEBUG}" && echo "... done."
	test -n "${DEBUG}" && echo "Creating blank authorization file..."
	test -e ${BOINC_DIR}/gui_rpc_auth.cfg || su -c "touch ${BOINC_DIR}/gui_rpc_auth.cfg" ${BOINC_USER} && test -n "${DEBUG}" && echo "... done."
	test -n "${DEBUG}" && echo "Copying BAM files..."
	for F in ${BOINC_SRC}/acct_mgr_login.xml ${BOINC_SRC}/acct_mgr_url.xml; do 
		test -s $F && cp -pu $F ${BOINC_DIR}
	done
	test -n "${DEBUG}" && echo "... done."
	;;
    sync)
	test -n "${DEBUG}" && echo "Syncing up BAM files..."
        for F in ${BOINC_DIR}/acct_mgr_login.xml ${BOINC_DIR}/acct_mgr_url.xml; do
                cp -p $F ${BOINC_SRC}
        done
        test -n "${DEBUG}" && echo "... done."
        ;;
    start)
	echo "Starting Boinc..."
	ulimit -v ${BOINC_MEM} ## limit total memory
 	ulimit -s unlimited ## override default stack limit
 	$0 install
	cd ${BOINC_DIR} 
 	su ${BOINC_USER} -c "${BOINC_DIR}/${BOINC} ${BOINC_PARAMS} >/dev/null 2>&1 &" && test -n "${DEBUG}" && echo "... done."
        ;;
    stop)
	echo "Stopping Boinc..."
        # cd ${BOINC_DIR}
        # su $BOINC_USER -c "${BOINC}"
        $0 pause
	$KILL -g "${BOINC_DIR}/${BOINC}" && test -n "${DEBUG}" && echo "... done."
        ;;
    restart)
	## Stop the service and regardless of whether it was
	## running or not, start it again.
	$0 stop
	## Sometimes boinc needs some time to stop
	sleep 30
	$0 start
        ;;
    pause)
	test -n "${DEBUG}" && echo "Pausing Boinc..."
	## Use "resume" to resume it.
	$KILL -STOP -g "${BOINC_DIR}/${BOINC}" && $KILL -CONT "${BOINC}" && test -n "${DEBUG}" && echo "... done."
	;;
    resume)
	test -n "${DEBUG}" && echo "Resuming Boinc..."
	$KILL -CONT -g "${BOINC_DIR}/${BOINC}" &&  test -n "${DEBUG}" && echo "... done."
	;;
    *)
	echo "Usage: $(basename $0) {start|stop|restart|pause|resume|install|sync}"
        exit 1
esac

ID: 7813 · Report as offensive
Augustine
Avatar

Send message
Joined: 10 Mar 06
Posts: 72
Message 9476 - Posted: 9 Apr 2007, 23:07:27 UTC

Some minor changes:
#!/bin/bash
#
# BOINC init and deployment script
#
# Copy to "/etc/init.d", run "chmod +x /etc/init.d/boinc" followed by
# "chkconfig --add boinc" and then run "/etc/init.d/boinc" to start it.
#
###
#
# For RedHat systems...
#
# chkconfig: 35 90 10
# description: BOINC client
#
###
#
# For LSB systems...
#
### BEGIN INIT INFO
# Provides: boinc
# Required-Start: $network $named $remote_fs
# Should-Start: $syslog $time ypbind ypclient
# Required-Stop: $network
# Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: BOINC client
### END INIT INFO

BOINC=boinc
BOINC_USER=nobody ## may require to change the login shell to /bin/sh first (e.g., RedHat)
BOINC_DIR="/tmp/${BOINC}" ## client program run directory
BOINC_SRC=<path to directory where the BOINC client resides> ## source directory for client program and accounts
BOINC_EXE=${BOINC_SRC}/boinc_5.8.17_i686-pc-linux-gnu ## client program
BOINC_PARAMS="-allow_remote_gui_rpc -check_all_logins -daemon" ## client program options
BOINC_MEM=1310720 ## maximum virtual memory allowed
BOINC_STACK=unlimited ## maximum stack size allowed
BOINC_BAM="acct_mgr_login.xml acct_mgr_url.xml" ## BAM account files
BOINC_SSL="ca-bundle.crt" ## SSL certificates

test -n "${DEBUG}" && BOINC_PARAMS="${BOINC_PARAMS} -redirectio" ## show debug messages

KILL=killall ## used to pause or resume client

test -x ${BOINC_EXE} || ( echo "${BOINC_EXE} does not exist or is not executable." >&2 && exit 1 )

case "$1" in
    install)
        ## set up run directory and accounts
        test -n "${DEBUG}" && echo "Creating run directory..."
        test -d ${BOINC_DIR} || su -c "mkdir -p ${BOINC_DIR} && chown ${BOINC_USER} ${BOINC_DIR}" ${BOINC_USER} && test -n "${DEBUG}" && echo "... done."
        test -n "${DEBUG}" && echo "Copying client..."
        test -d ${BOINC_DIR} && su -c "cp -p ${BOINC_EXE} ${BOINC_DIR}/${BOINC}" && test -n "${DEBUG}" && echo "... done."
        test -n "${DEBUG}" && echo "Creating blank authorization file..."
        test -e ${BOINC_DIR}/gui_rpc_auth.cfg || su -c "touch ${BOINC_DIR}/gui_rpc_auth.cfg" ${BOINC_USER} && test -n "${DEBUG}" && echo "... done."
        test -n "${DEBUG}" && echo "Copying BAM files..."
        for F in ${BOINC_BAM} ${BOINC_SSL}; do
                test -s ${BOINC_SRC}/$F && cp -pu ${BOINC_SRC}/$F ${BOINC_DIR}
        done
        test -n "${DEBUG}" && echo "... done."
        ;;
    sync)
        test -n "${DEBUG}" && echo "Syncing up BAM files..."
        for F in ${BOINC_BAM}; do
                test -s ${BOINC_DIR}/$F && cp -p ${BOINC_DIR}/$F ${BOINC_SRC}
        done
        test -n "${DEBUG}" && echo "... done."
        ;;
    start)
        echo "Starting Boinc..."
        ulimit -v ${BOINC_MEM} ## limit total memory
        ulimit -s ${BOINC_STACK} ## override default stack limit
        $0 install
        cd ${BOINC_DIR}
        su ${BOINC_USER} -c "${BOINC_DIR}/${BOINC} ${BOINC_PARAMS} >/dev/null 2>&1 &" && test -n "${DEBUG}" && echo "... done."
        ;;
    stop)
        echo "Stopping Boinc..."
        # cd ${BOINC_DIR}
        # su $BOINC_USER -c "${BOINC}"
        # $0 pause
        $KILL -g "${BOINC_DIR}/${BOINC}" && test -n "${DEBUG}" && echo "... done."
        ;;
    restart)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        ## Sometimes boinc needs some time to stop
        sleep 30
        $0 start
        ;;
    pause)
        test -n "${DEBUG}" && echo "Pausing Boinc..."
        ## Use "resume" to resume it.
        $KILL -STOP -g "${BOINC_DIR}/${BOINC}" && $KILL -CONT "${BOINC}" && test -n "${DEBUG}" && echo "... done."
        ;;
    resume)
        test -n "${DEBUG}" && echo "Resuming Boinc..."
        $KILL -CONT -g "${BOINC_DIR}/${BOINC}" &&  test -n "${DEBUG}" && echo "... done."
        ;;
    *)
        echo "Usage: $(basename $0) {start|stop|restart|pause|resume|install|sync}"
        exit 1
esac

HTH

ID: 9476 · Report as offensive

Message boards : BOINC client : Deploying BOINC

Copyright © 2022 University of California. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.