Another copy of BOINC is already running - redux


log in

Advanced search

Questions and Answers : Unix/Linux : Another copy of BOINC is already running - redux

Author Message
Profile greencreeper
Send message
Joined: 22 Jun 03
Posts: 49
Credit: 394,886
RAC: 318
United Kingdom
Message 11580 - Posted: 23 Jul 2004, 21:25:51 UTC
Last modified: 23 Jul 2004, 21:28:16 UTC

I'm helping a guy to create a boot script for BOINC. I've installed programs and created boot scripts without problems on Solaris but Linux Mandrake has just given us one problem after another. We've been working on the script for 2 days now. I asked for help on the Predictor forum but it's down otherwise I'd be posting there :)

We've created this boot script and using chkconfig it's now set to run on boot - 2345. It won't start though - "Another copy of BOINC is already running". Testing the script from the command line gives us the same error. A ps -ef shows no copy of BOINC running. I asked him to add an if but that doesn't do anything - "Another copy of BOINC is already running". Aaaaaaaaaargh. Permissions are ok and there's no lock or pid file as far as we know.

boinc_cli script

#!/bin/sh
#chkconfig: 2345 85 15
#description: BOINC distributed processing client
. /etc/rc.d/init.d/functions
SHELL=/bin/sh; export SHELL

case "$1" in
start)
echo -n "Starting BOINC"
echo "Starting BOINC ` date +%m%d%y`" >> /var/log/boinclog/seti.log
if ps -ef | grep -v grep | grep -v "boinc_cli" | grep "boinc"
then
echo "Warning: BOINC running" >> /var/log/boinclog/setierr.log
else
su boinc -c "/home/boinc/boinc >>/var/log/boinclog/seti.log 2>>/var/log/boinclog/setierr.log &"
fi
;;
stop)
echo -n "Shutting down BOINC"
echo "Shutting down BOINC ` date +%m%d%y`" >> /var/log/boinclog/seti.log
killall boinc
rm -f /home/boinc/lockfile
;;
restart)
$0 stop
sleep 5
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

exit 0


Any help would be appreciated - looks very much like BOINC won't run from a script.

TIA.

--
john

Darren
Volunteer tester
Avatar
Send message
Joined: 2 Jul 99
Posts: 259
Credit: 275,618
RAC: 0
United States
Message 11763 - Posted: 24 Jul 2004, 4:46:52 UTC

Though I didn't write it, here's a script that I use on one of my Mandrake 10 systems. It works with no problem.

#!/bin/sh

# boincctl - Control boinc. Stop it/Start it/Restart it. Originally
# meant to be used as a boot time script so that boinc starts
# at boot time, but can be used any time. For a boot time script
# put this in /etc/init.d and make the appropriate links from
# the appropriate run level areas (ie. /etc/rc3.d). (This was
# developed on RedHat 9 so I know what the boot areas are there.
# It should also work on Solaris, I'm not familiar with other
# flavors of Linix/UNIX.)

# Author: Charles Dennett/Rochester, NY USA.
# Email: dennett@rochester.rr.com
# Date: December 12, 2003.
# Version: 1.0
#
# History: Version 1.1. May 20. 2004. Update stop function to use SIGTERM (15).
#
# Comment: Copyright by the author. Feel free to make modifications.
# However, please keep these comments intact.

# Use: To start: boincctl start
# To stop: boincctl stop
# To restart: boincctl restart
# Status: boincctl status

#
# Variables that will need to be configured.
#
# BOINC_HOME: The directory where boinc will run. It should be run
# in its own directory to keep its files and subdirectories
# separate form others.
#
# BOINC_BIN: The full path to the boinc executable.
#
# RUN_AS: Username that boinc is to run as.
#
# BOINC_OUT: File to direct output from boinc. If you don't want this,
# set it to /dev/null.
#
# BOINC_PARMS: Any command line parameters for boinc you wish to pass to
# it. If you don't want any, simply use a null list ("").

BOINC_HOME=[put path here]
BOINC_BIN=[put path here]
RUN_AS=[put user name here]
BOINC_OUT=boinc.out
BOINC_ERR=boinc.err
#BOINC_PARMS=""
BOINC_PARMS=""

# No other changes needed below this, most likely.

# Functions

. /etc/init.d/functions

start()
{
echo "Starting boinc"
eval $SU_CMD
}

stop()
{
echo -n "Stopping boinc"
# pkill -15 `basename $BOINC_BIN`
killproc `basename $BOINC_BIN` -15
}

restart()
{
stop
echo "Be patient. Waiting 10 seconds for all to stop."
sleep 10
start
}

#----------------------------------------------------------------------------
#
# Start of mainline code
#

# If the user running this script is not the user we want boinc to run as, set
# up the su command so that we can become that user. Note, we will have to
# know this user's password. If this script is run at boot time, it is root
# that is running this script and no password is required.

WHO_AM_I=`whoami`
CMD="$BOINC_BIN $BOINC_PARMS >> $BOINC_OUT 2>> $BOINC_ERR &"

if [ "$WHO_AM_I" != "$RUN_AS" ]; then
SU_CMD="su $RUN_AS -c "$CMD""
else
SU_CMD=$CMD
fi



# Go to where we want boinc to run

cd $BOINC_HOME

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
echo "What do I do here for status?"
tail -20 $BOINC_OUT
;;
*)
echo "Usage: `basename $0` start|stop|restart|status"
exit 1
;;
esac

Profile greencreeper
Send message
Joined: 22 Jun 03
Posts: 49
Credit: 394,886
RAC: 318
United Kingdom
Message 12134 - Posted: 24 Jul 2004, 23:51:14 UTC - in response to Message 11763.

> Though I didn't write it, here's a script that I use on one of my Mandrake 10
> systems. It works with no problem.
>

Thanks. The script we've created was based on that script and the Predictor script.

I had a look at the BOINC source code and it seems that BOINC might be exiting because of a problem with semaphores. At the moment, the only user that can run BOINC is root - ordinary users can't run it. I'm thinking that there might be something wrong with the system settings for semaphores. I'm not entirely certain of what I'm looking for, or what the values should be. Any input would be appreciated.

--
john

whatsupdoc
Send message
Joined: 30 Apr 01
Posts: 6
Credit: 16,825
RAC: 132
United States
Message 15152 - Posted: 10 Aug 2004, 12:57:58 UTC - in response to Message 11763.
Last modified: 10 Aug 2004, 12:59:29 UTC

> Though I didn't write it, here's a script that I use on one of my Mandrake 10
> systems. It works with no problem.
>
(snip script)
>
>
I had to make one small change to get it to work for me... I had to change the "eval $su_cmd" to "su " to make it quit complaining about not having the correct paramaters to su. Since I'm running it as root, there's no need to supply the password for that user. :-)

Hmm... it SAID it was starting BOINC, but for some reason it's not running... PS aux | grep boinc says it's not running... I'm gonna have to look into this... :(

Questions and Answers : Unix/Linux : Another copy of BOINC is already running - redux

Copyright © 2014 University of California