Thread 'BOINC on Linux questions'

Message boards : BOINC Manager : BOINC on Linux questions
Message board moderation

To post messages, you must log in.

AuthorMessage
Michelle Knight

Send message
Joined: 19 Mar 07
Posts: 5
Message 8869 - Posted: 19 Mar 2007, 8:01:38 UTC

Sorry to be a noob, but I'm going slightly crazy.

1) What is the "auth"? I signed up to Seti@home ages ago, and that is running nicely on a Linux machine with a GUI ... got it set up, no problem.

How do I attach the client (by command line) to my existing account? I just can't get the command line right. Assume seti please.

2) My second Linux machine, however, is a different kettle of fish. It doesn't run under GUI, and it is typically switched on and then just sits there. I don't usually log on even.

What I need to do is have, presumably a cron job, that will check if boinc is running and if not, start it. I'm presuming that I'm going to have to filter the ps results somehow .. but I am presuming that someone has done this already and happens to have a solution to hand.

TIA for any help.

Michelle.
ID: 8869 · Report as offensive
River~~
Avatar

Send message
Joined: 12 Mar 07
Posts: 59
Message 8873 - Posted: 19 Mar 2007, 9:15:06 UTC - in response to Message 8869.  

1) What is the "auth"? I signed up to Seti@home ages ago, and that is running nicely on a Linux machine with a GUI ... got it set up, no problem.


auth is your long hexadecimal authorisation key - it acts as a kind of combined username and password and is the way your client identifies and verifies itself to the server. I believe it was done this way originally to save time in the connection process.

To find your auth, go to a machine where you have successfully connected to the project of your choice, and go to the directory (folder) where you installed the boinc software. On Linux this will likely be called BOINC (in uppercase) though which directory you installed it under was down to you. On Windows (for other readers with this question) it will almost certainly be C:\Program Files\BOINC.

Look for files called account_*.xml

You will see that the * matches some version of the url of your chosen project(s). There will be one such file for each project.

Look at this file, the xml tag <authenticator> is the one you want.

How do I attach the client (by command line) to my existing account? I just can't get the command line right.


you won't get the command line right till you get the right auth in there.

The command for SETI is

./boinc_cmd --project_attach http://setiathome.berkeley.edu/ abcdef1234567890abcdef1234567890

but using your own long hex number of course.


even easier

(assumes you have an easy way of copying a small file from the working box to the one you are setting up). Just copy across the account_*.xml file (one for each project if you are running more than one project by then). Instant attach when boinc next runs on the new box.

HTH

River~~

ID: 8873 · Report as offensive
River~~
Avatar

Send message
Joined: 12 Mar 07
Posts: 59
Message 8874 - Posted: 19 Mar 2007, 9:30:33 UTC
Last modified: 19 Mar 2007, 10:03:56 UTC

2) My second Linux machine, however, is a different kettle of fish. It doesn't run under GUI, and it is typically switched on and then just sits there. I don't usually log on even.

What I need to do is have, presumably a cron job, that will check if boinc is running and if not, start it. I'm presuming that I'm going to have to filter the ps results somehow .. but I am presuming that someone has done this already and happens to have a solution to hand.


There are three stages needed to do what you need

1. write a script that starts boinc with logging going where you want it
2. write a script that starts the first script as a daemon
3. write a script that calls the second script as and when required.

This post gives suggestions for stage 1 and 2. A separate post gives stage 3, as it is quite long.

Stage 1

copy this text into a file called boinclive in your BOINC directory

#!/bin/sh
cd /etc/local/bin/BOINC ;#change this to suit your BOINC directory
./boinc >./messagelog 2>./errorlog ;#change these filenames as desired


make the file runnable with

chmod 755 boinclive

and test it

./boinclive

You should find that boinc starts up, for example by looking at ps from another console, or by looking in the log after you kill boinc with ctrl-c. The main point of this test is to verify that you log info is going where you expect.

Stage 2

Copy this text into file boincdaemon

#!/bin/sh
cd ~boinc ;# change this...
nohup ./boinclive &


make it runnable and test it. This time when you test it you get a command prompt back (perhpas you need to hit return again to see it) because hopefully boinc is running as a daemon.

See if there are any messages in the messagelog

tail messagelog

log out, go away, come back, log in, ps -- is boinc stil there. Good, you have a daemon.

HTH
R~~
ID: 8874 · Report as offensive
River~~
Avatar

Send message
Joined: 12 Mar 07
Posts: 59
Message 8875 - Posted: 19 Mar 2007, 10:01:04 UTC
Last modified: 19 Mar 2007, 10:41:31 UTC

2) My second Linux machine, however, is a different kettle of fish. It doesn't run under GUI, and it is typically switched on and then just sits there. I don't usually log on even.

What I need to do is have, presumably a cron job, that will check if boinc is running and if not, start it. I'm presuming that I'm going to have to filter the ps results somehow .. but I am presuming that someone has done this already and happens to have a solution to hand.


There are three stages needed to do what you need

1. write a script that starts boinc with logging going where you want it
2. write a script that starts the first script as a daemon
3a. write a script that calls the second script
3b. arrange for it to be called at appropriate times

This post gives suggestions for stages 3a and 3b, once you have a running daemon. My previous post gave my solution to 1 and 2.

You could do stage 3 using a cron job, it would work, but in my opinion it is not the best way. How to do it with cron I leave as an exercise to others...

My solution was to use the same method my distro uses to start up its own services. That method is called SystemV, and you can read about it at http://www.freeos.com/articles/3243/ or google it - there are a lot of intros to it on the web.

Hopefully tho you will not need to undertand SystemV startup to follow the suggestions below (unless you are like me and need to understand what is going on at all times)

To check if your distro uses SystemV, look for the directory init.d, which could be at

/etc/init.d

or

/etc/rc.d/init.d

or perhaps

/sbin/init.d

Also look for the directory rc0.d if you didn't already find it - it should be one of eight directories with names 0..6 and letter S. On debian these directories are at

/etc/init.d
/etc/rc0.d
...
/etc/rc6.d
/etc/rcS.d

and that directory structure is what rest of this post assumes. Adjust if need be.

It rare to find a recent distro that does not use SystemV startup at all - Slackware doesn't, but hardly counts as 'recent' anymore...

Assuming you found an init.d directory, there are now two sub-stages,

3a. write /etc/init.d/boinc
3b. make it run when needed

Stage 3a

put the following text into a file /etc/init.d/boinc - you may have to be root to do this, or to run as sudo.


#! /bin/sh

cd ~boinc ;# alter this to suit

case "$1" in
start)
echo -n "Starting BOINC"
su boincuser ./boincdaemon ;# change boincuser to suit
echo "."
;;
stop)
echo -n "Stopping BOINC"
./boinc_cmd --quit
echo "."
;;
reload|restart|force-reload)
$0 stop
sleep 11
$0 start
;;
*)
echo "Usage: boinc {start|stop|restart|force-reload}" >&2
exit 1
;;
esac

exit 0


Note that it is very important to think about the username who will run boinc. This new script will be run as root during startup. You do not want boinc to run as root, or in the unlikely event that you get hacked, your boinc apps can do anything they like.

Similarly, my suggestion is that you do not run boinc as your own username either, but as a separate user, called perhaps boinc.

Test this script,

/etc/init.d/boinc start

should start boinc. Similarly test

/etc/init.d/boinc stop
/etc/init.d/boinc restart


Stage 3b

Again as root (or using sudo), make the following links

ln /etc/init.d/boinc /etc/rc2.d/S99boinc
ln /etc/init.d/boinc /etc/rc3.d/S99boinc
ln /etc/init.d/boinc /etc/rc4.d/S99boinc
ln /etc/init.d/boinc /etc/rc5.d/S99boinc

The first of these starts boinc during normal startup. The other 3 make sure boinc is not stopped in the event that you change 'runlevel' to levels 3 to 5 inclusive.

Also make the following links

ln /etc/init.d/boinc /etc/rc0.d/K00boinc
ln /etc/init.d/boinc /etc/rc1.d/K00boinc
ln /etc/init.d/boinc /etc/rc6.d/K00boinc
ln /etc/init.d/boinc /etc/rcS.d/K00boinc

These tell the system to stop boinc when you shutdown, reboot, go into single user maintenance mode, etc. By the way, that really is a letter S in that last link, it is not a number 5.

Go on, reboot, test it... as soon as you get you prompt back after the reboot, ps should show boinc already running.

My own preference is to use this startup method even on boxes that have the gui.

HTH
R~~

PS - when cut-and-pasting from the code above, click on reply first - the text box will preserve the layout which the quote doesn't. If you don't go on to click OK it will not actually post a reply.
ID: 8875 · Report as offensive
Michelle Knight

Send message
Joined: 19 Mar 07
Posts: 5
Message 8897 - Posted: 19 Mar 2007, 17:53:24 UTC - in response to Message 8875.  

Many thanks River~~ - I'll get that going sometime tonight, I hope. Wonderful response.
ID: 8897 · Report as offensive
Michelle Knight

Send message
Joined: 19 Mar 07
Posts: 5
Message 8904 - Posted: 19 Mar 2007, 23:30:22 UTC - in response to Message 8897.  

Hi River~~,

Got so far, but when trying to execute the file /etc/init.d/boinc as root, I get ...

l2j:/home/l2jdbuser # /etc/init.d/boinc restart
bash: /etc/init.d/boinc: /bin/sh^M: bad interpreter: No such file or directory

Any ideas please?

Michelle.
ID: 8904 · Report as offensive
Michelle Knight

Send message
Joined: 19 Mar 07
Posts: 5
Message 8905 - Posted: 19 Mar 2007, 23:31:28 UTC - in response to Message 8904.  

(I think I know what I did, the ^M gave it away. Must have been the editor I used.)
ID: 8905 · Report as offensive
Michelle Knight

Send message
Joined: 19 Mar 07
Posts: 5
Message 8906 - Posted: 19 Mar 2007, 23:47:09 UTC - in response to Message 8905.  

All sorted - many thanks River~~ - excelent tutorial, well written ... great stuff!
ID: 8906 · Report as offensive
River~~
Avatar

Send message
Joined: 12 Mar 07
Posts: 59
Message 8909 - Posted: 20 Mar 2007, 4:39:33 UTC - in response to Message 8905.  

(I think I know what I did, the ^M gave it away. Must have been the editor I used.)


It's the copy from the web.

The http standard always gives ^M^J (also known as \r\n) as a line separator, wheras unix uses ^J ( \n ) alone to save one byte per line - if you use the mouse to copy the text from the webpage in a gui then it *should* strip the \r for you, but if you saved the page source and edited it directly you'd need to strip out the \r manually as you discovered.

Anyone else needing to do this manually, if your text editor can't understand ^M in a substitution command, tell it to look for and remove all the \r characters.

If your favourite unix editor has a facility to 'convert DOS files' that will do the trick as well -- surprisingly DOS follows the http convention and unix doesn't...

Glad it all worked for you. The init.d script is easy enough to modify for other programs so you can now roll your own daemons for any other processes. Sadly I can't claim to have written the one I gave you, I blagged it from another program when I set up boinc.

One final tip: Call the daemon script boincd instead of boincdaemon and it will even look like a traditional unix daemon in the ps listing: httpd sshd ... ;-)

R~~
ID: 8909 · Report as offensive
Mephist0

Send message
Joined: 24 Feb 08
Posts: 2
Sweden
Message 15550 - Posted: 24 Feb 2008, 17:31:59 UTC
Last modified: 24 Feb 2008, 17:37:23 UTC

Thx! This thread helped me to configure my Ubuntu machine to start working when i start it up! :)
ID: 15550 · Report as offensive

Message boards : BOINC Manager : BOINC on Linux questions

Copyright © 2024 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.