BOINC-AUSTRALIA FORUM

Members Only => ALL ABOUT HARDWARE => ALL THINGS LINUX => Topic started by: Dingo on February 23, 2009, 05:37:11 AM

Title: Yoda Help with your Cron script
Post by: Dingo on February 23, 2009, 05:37:11 AM
Yoda,

Now that I have the majority of my crunchers on command line Ubuntu I thought that I would give your script a go as I see that some run out of work and sit idle for a while till milkyway gets more work.  I kept your script below but I get an "Authorization failure -155" error on all the nodes except the local one.

Any Ideas ?   The password that I use is the password that is in gui_rpc_auth.cfg and is the same password that I use to log into the PC's.  I tried to search but didn't find anything useful.

Thanks

# Script to refresh Milkyway - typically used in a cron job
# Written by Webmaster Yoda (Bert Doorn) of BOINC@AUSTRALIA

myNodes="QUAD2 QUAD3 QUAD4 QUAD5"
myPasswd=whatever
myProject=http://milkyway.cs.rpi.edu/milkyway/

# localhost first - no need for password and hostname
/usr/bin/boinc_cmd --project $myProject update

# Now the rest of the farm
for node in $myNodes
do
  /usr/bin/boinc_cmd --host $node --passwd $myPasswd --project $myProject update
done
---------------------------------------------------------------------------------------------------------------------------
My cron job looks like this:  0,10,20,30,40,50 * * * *  /home/username/updatemw

------------------------------------------------------------------------------------------------------------------------------
Title: Re: Yoda Help with your Cron script
Post by: yoda on February 23, 2009, 09:46:52 PM
Sorry, missed this post.  I now have the same problem Veebee had some time ago in that "show unread posts" isn't working properly.  May be something to do with me having logged out and back in.




Anyway...   I don't see any obvious reason why it isn't working, if you have set the first 3 variables to reflect your setup (i.e. the node names or IPs, password and project to update)

You could try putting the password and project in quotes, i.e.
myPasswd = "WhatEverYourPasswordIs"
myProject = "http://milkyway.cs.rpi.edu/milkyway/"

The PC running the script does of course need to be included in the remote_hosts.cfg file on the other PC's or they won't allow it in..
Title: Re: Yoda Help with your Cron script
Post by: Dingo on February 23, 2009, 10:50:53 PM


I will have to remember next weekend when I am back at home.  I think I will change the host names to IP addresses as that may be the problem, and the quotes as well.

Thanks
Title: Re: Yoda Help with your Cron script
Post by: Mike Mitchell on February 26, 2009, 12:24:42 AM
G'day Dingo,
I had the same problem with my Kubuntu box and fixed by cd'ing to the working directory /var/lib/boinc-client in my case, and that worked a treat. I haven't tried absolout paths but I would have thought that would have worked the same. But it doesn't. Must have someting to do with the way the commands execute (probably) locally.

You could try adding /var/lib/boinc-client to $PATH
Title: Re: Yoda Help with your Cron script
Post by: WikiWill on February 26, 2009, 07:11:52 AM
I found the same. It appears boinc_cmd expects to be run only from the BOINC directory and reads/writes other files by referencing the current working directory, so adding to the $PATH variable doesn't help.
Title: Re: Yoda Help with your Cron script
Post by: Dingo on February 28, 2009, 10:39:38 AM
OK I give up I can't get it to work.  Can't even run the command on the command line and get a authorization error on the local host.  :furious:

I have other projects attached to most of my PC's now so it won't run out of work.

Title: Re: Yoda Help with your Cron script
Post by: Dingo on March 16, 2009, 04:46:16 AM
OK, I am trying again. In the Milkyway forum there re posts on scripts but just for MS.  I have put ina post to see if there is a way to send a command from a MS bat file to Linux ??   If anyone knows please let me know.

  http://milkyway.cs.rpi.edu/milkyway/forum_thread.php?id=714&nowrap=true#15496

If there is a way to pass it from XP I will be doing the  :dance2: beause to get the cron script to work I have to get all the pc's one at a time hooked up to a monitor keyboard etc.  Just too much trouble for now.

Title: Re: Yoda Help with your Cron script
Post by: Mike Mitchell on March 16, 2009, 01:40:49 PM
If all the Linux boxes have network access, then you could install a cron job for each box on one Linux computer ( a defacto server)
Title: Re: Yoda Help with your Cron script
Post by: yoda on March 16, 2009, 01:56:22 PM
Yes, that's how my script works (on Ubuntu).  But it's not working for Dingo for some reason.



# Script to update a project - typically used in a cron job
# Written by Webmaster Yoda of BOINC@AUSTRALIA

# This version:
#  uses IP Addresses to access the nodes
#  takes the project URL as paramater

myNetwork="192.168.0"
myNodes="101 102 103 201 202 203 204 205"
myPasswd="whatever"

if [ -z $1 ] # No URL provided!
then
  echo Please provide the Project URL as a command-line argument
  echo e.g. update.sh http://abcathome.com/
elif [ -n $1 ]
then
# use first parameter for project URL
  myProject=$1

# localhost first
  /usr/bin/boinc_cmd --project $myProject update

  # Now the rest of the farm
  for node in $myNodes
  do
    /usr/bin/boinc_cmd --host $myNetwork.$node --passwd $myPasswd --project $myProject update
  done
fi
# All done!


Title: Re: Yoda Help with your Cron script
Post by: WikiWill on March 16, 2009, 02:15:02 PM
Quote from: Dingo on March 16, 2009, 04:46:16 AM
I have put ina post to see if there is a way to send a command from a MS bat file to Linux ??   If anyone knows please let me know.
  http://milkyway.cs.rpi.edu/milkyway/forum_thread.php?id=714&nowrap=true#15496

Dingo, you could do this with a 3rd party utility like Putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/) which allows ssh from Windows to Linux.  The Putty download/install package includes a command called plink which you can use in batch files to do something like:

    plink root@myserver /BOINC/boinc_cmd http:... update

or

    plink root@myserver /usr/local/run-my-boinc-script.sh

You may want to use public/private keys for authentication as this is much nicer than hard-coded passwords in scripts.  This is pretty easy to do.  Let me know if you need detailed steps.  On the Windows side, you generate a key pair using the puttygen.exe utility (run it then clicking on Generate button, then save the private and public keys in files).  Then you configure ssh on Linux to use the public key you just generated.

This might be what you're looking for.  I know no easy way to do it natively from Windows!
Title: Re: Yoda Help with your Cron script
Post by: Dingo on March 17, 2009, 07:09:41 AM
Thanks for the replies. I will have a look next weekend at putty when I get back home.