LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   BOINC as a service to start at boot (https://www.linuxquestions.org/questions/linux-general-1/boinc-as-a-service-to-start-at-boot-384357/)

purelithium 11-18-2005 10:20 AM

BOINC as a service to start at boot
 
I want to have BOINC start when I boot my machine where would i have to put reference to the boinc shell script for it to do this? I mean I want this to start even before the x server starts. so if i'm not logged in, it can still run.

the path to my boinc file is

/home/gelan/pgms/BOINC/

do I have to put a symlink somewhere?

I'm really not sure how to go about this.

chemdawg 11-18-2005 11:58 AM

Re: BOINC as a service to start at boot
 
Quote:

Originally posted by purelithium
I want to have BOINC start when I boot my machine where would i have to put reference to the boinc shell script for it to do this? I mean I want this to start even before the x server starts. so if i'm not logged in, it can still run.

the path to my boinc file is

/home/gelan/pgms/BOINC/

do I have to put a symlink somewhere?

I'm really not sure how to go about this.


What I did was create a user "boinc" and have the process run as that user. Do not allow BOINC to run as root. I did what it says to do on this page to get BOINC to start at boot: http://www.spy-hill.com/~myers/help/boinc/unix.html

There are a couple of modifications you may have to make with your daemon script to get it to start as a service. Post back if this does not work for you.

purelithium 11-18-2005 12:49 PM

How should I edit the script he gave? I have no clue what to do.

and where do I put it? I tried putting it in the /etc/init.d/ as boinc, but when I ran the command

service boinc start

it gave an error

Cannot find boinc service

What do i do?

chemdawg 11-18-2005 01:47 PM

Quote:

Originally posted by purelithium
How should I edit the script he gave? I have no clue what to do.

and where do I put it? I tried putting it in the /etc/init.d/ as boinc, but when I ran the command

service boinc start

it gave an error

Cannot find boinc service

What do i do?

Hi. You may not have to make any modifications if it works. Here's my setup: all boinc files are in the directory /home/boinc

The script he gave has 2 or 3 lines in it at the beginning that say this:

BOINCUSER=boinc
BOINCDIR=/var/lib/boinc
BUILD_ARCH=i686-pc-linux-gnu
BOINCEXE=/usr/bin/boinc_client

Now, you will need to edit these to fit your needs if you didn't do it exactly like he said in that article. For example, if your boinc directory is like mine it's in /home/boinc, not /var/lib/boinc. You should therefore change that line to read: BOINCDIR=/home/boinc You will also need to rename your boinc executable to whatever it says in this BOINCEXE line. I named mine "boinc", so that line in mine looks like this: BOINCEXE=/home/boinc/boinc

Now once you have it edited you need to put it where it says to put it (/etc/rc.d/init.d) and make sure you saved it as "boinc" and make sure you make it executable (chmod a+x boinc).

Also make sure you chmod your boinc executables to make them executable. Make sure you do this so it will add boinc as a service:

chkconfig --add boinc

Also, you need to make sure you change the permissions on your /home/boinc directory and all files within to give you (not just root) permissions. do this by cd'ing into /home/boinc and then do this (as root):

chown boinc:users *

if there are any folders in the /home/boinc directory make sure you change the permissions on them also.

Now you should be able to start the boinc service with "service boinc start"
You can stop it with "service boinc stop", and if you want to restart you can do a "service boinc restart".

Hope this helps

purelithium 11-18-2005 02:12 PM

hmm.. now whenever i try to start the service, it fails...

# service boinc start
Starting BOINC client as a daemon: [FAILED]

hmm... Thank you so much for taking the time to go through all of this for me, I know how hard it is to break stuff down to simple steps like this.

chemdawg 11-18-2005 03:02 PM

can you start boinc as root? su to root and then cd to the /home/boinc directory (or wherever boinc's home is) and do this:

Code:

./boinc &
see if it starts. You will have to do a ps -aux and see if it starts. If so, then the executable is not your problem, and you can try changing this: BOINCUSER=root and see if "service boinc start" will work then. If so, then permissions are your problem. I am certain we can get this working - just takes a liitle troubleshooting.

purelithium 11-18-2005 03:22 PM

changing the BOINCUSER to root allows me to start the service now, but It doesn't seem like it's actually computing anything.

Why don't I want to do this? Why is it bad to run this as root?

chemdawg 11-18-2005 05:21 PM

Quote:

Originally posted by purelithium
changing the BOINCUSER to root allows me to start the service now, but It doesn't seem like it's actually computing anything.

Why don't I want to do this? Why is it bad to run this as root?

Well, just in theory you can, but in general it's probably not the best idea to have any process that does not need to be run as root running as root. This one should not need to be run as root.

OK this sounds like a permissions problem to me. Check to make sure your boinc directory and EVERYTHING in there is owned by boinc. Do this as follows:

Code:

ls -l
you should not see root anywhere on the output. if you do see root, do this:

Code:

chown boinc:user *
then do ls -l again and see if everything is owned by boinc. The reason for this is that the user boinc cannot run things owned by root.

Are you running SETI? If so, you will have a /home/boinc/projects directory as well. You must change the ownership of that as well as everything in it to boinc as well, using the same procedure. Also, did you connect to a project? If you didn't, you won't be computing anything for sure.

purelithium 11-18-2005 05:58 PM

excellent! it works as the boinc user now, but I'm still not seeing it using any CPU power... i open ksysguard and look at the boinc process, and it doesn't use any cpu power. but before, when I ran it inside my normal user account, I would see it using almost all of the CPU power.

I am attached to the setiathome project, and i made sure it was attached by running the boinc mgr as the webpage you linked to told me to.

Hmm...

chemdawg 11-18-2005 06:01 PM

when you run it as boinc user, do this:

Code:

ps -aux
and you should see 2 things running as boinc. you should see the actual boinc program itself, and you should see the setiathome program. They should both be running as boincuser. Are they both running, or is only one running?

purelithium 11-18-2005 06:26 PM

doh! I forgot about that, that it's not the boinc process, it's the setiathome one that does the work!

Thanks, it's working like a charm now! thanks so much!

Hopefully all this will help someone else in the future, eh?

Thanks again!

purelithium 11-18-2005 06:46 PM

Just set it up on another box in about 5 minutes, awesome, thanks!

chemdawg 11-18-2005 07:34 PM

Quote:

Originally posted by purelithium
Hopefully all this will help someone else in the future, eh?
Maybe. I continue to be amazed at the seemingly non-existant population of BOINC users that read this forum. As popular as it is, there is relatively little talk about it here.

On a related note, are you using optimized clients?

purelithium 11-18-2005 08:44 PM

That's true, I expected to find a lot more information on here about the boinc clients!


No, I couldn't get the AMD 64 client to work at all. I'm using the general x86 linux client. I just don't feel like i'm getting the most out of my AMD dual core...

chemdawg 11-18-2005 09:04 PM

Can't really help with the AMD stuff ... wish I could.

There is one more thing I forgot to mention. If your computer gets shut down improperly (power failure), BOINC will not restart as you'd expect. This is due to the presence of a lockfile that prevents it. The lockfile gets created when the service is started and deleted when it is stopped. When the power goes out, the lockfile does not get deleted. You can find it in your boinc directory. To get around this problem, you can edit that script as follows:
Code:

# Mandrake 10.1 really wants a lock file...
LOCKDIR=/var/lock/subsys

comment out the LOCKDIR so it doesn't create the lockfile:
Code:

# Mandrake 10.1 really wants a lock file...
# LOCKDIR=/var/lock/subsys

Then, you should edit these lines so that it won't ever look for a lockfile (just comment out):
Code:

  cd $BOINCDIR

      #  if [ -f lockfile ] ; then
      #    echo -n "Another instance of BOINC is running (lockfile exists)."
      #    echo_failure
      #    echo
      #    exit 4
      #  fi


That's it, except for you not using the optimized clients, your setup is exactly like mine. You might find an optimized client here or here's a bunch of places to look here There are several, you should try a few - maybe one will work. Don't forget to try both the optimized seti client AND the optimized boinc client. Both can make a difference.


All times are GMT -5. The time now is 11:33 PM.