Automating bunker filling

A place to discuss how to set up BOINC Manager and how to get the best results from your connected hardware
Post Reply
Woodles
Active UBT Contributor 20+ yrs
Posts: 9892
Joined: Thu Dec 20, 2007 12:00 am
Location: Cambridgeshire

Automating bunker filling

Post by Woodles » Tue Apr 16, 2019 9:58 am

All,

Some challenges count work reported during a certain time frame. The general approach to this is to complete the work outside the time specified and upload it once the challenge has started. This is commonly referred to as "bunkering"

The trick is to download as many tasks as you will be able to complete BEFORE the challenge actually starts and to crunch them ready for uploading later.

This is a popular strategy so the usual result is that once a challenge has been announced, all the work for the project is quickly grabbed and the user is sat there continually pressing the "Update" button trying to fill their caches.

Having done this on numerous projects that either produce little work or where the server can't handle the load and keeps stalling, I decided to create a simple batch file to automate the process.

Code: Select all

@echo off
SET PROJECT=https://rake.boincfast.ru/rakesearch/

:START

::Do any retries
echo Retry
boinccmd --network_available

::Pause for two seconds
TIMEOUT /T 2 >NUL

::Ask for a project update
echo Update
boinccmd --project "%PROJECT%" update

::Pause for twenty eight seconds then repeat
TIMEOUT /T 28 >NUL

GOTO START
  • Copy the above into notepad and save it as a DOS batch file (extension ".bat") into any folder you please.
  • Change the "SET PROJECT=" line to point to the project you're interested in bunkering. No spaces between the '=' and the 'http' and quotes aren't necessary.
  • Copy "boinccmd.exe" from the BOINC programme directory into the same folder. These are the only two files you need.
  • Change your cache settings to the required duration.
  • Click on the file to run it. This will open a DOS command window where status messages are displayed. If you don't want the messages, remove the two "echo" commands. The file will retry any pending transfers, request new work and repeat every thirty seconds.
  • Make a cup of tea and enjoy a Hobnob.
  • Once your cache is full or you've reached the limit of tasks that the project will send you, set BOINC network access to OFF
  • Close the DOS window
Don't forget to set your cache sizes back to your normal settings nor to re-enable BOINC network access once the challenge starts.

Mark

bigsinky
Active UBT Contributor 15+ yrs
Posts: 250
Joined: Wed Mar 28, 2018 8:27 pm
Location: Northern Ireland
Contact:

Re: Automating bunker filling

Post by bigsinky » Wed Apr 17, 2019 4:12 pm

thanks mark. using it now to fill up my PG cache
Image

Woodles
Active UBT Contributor 20+ yrs
Posts: 9892
Joined: Thu Dec 20, 2007 12:00 am
Location: Cambridgeshire

Re: Automating bunker filling

Post by Woodles » Wed Oct 30, 2019 10:17 am

And since it was asked for during the last sprint, the Linux version:

Code: Select all

#!/bin/bash

#Project URL to bunker
PROJECT=https://rake.boincfast.ru/rakesearch/

#Repeat indefinitely
while true
do

#Do network retries
	echo "Retry"
	boinccmd --network_available

#Pause for two seconds
	sleep 2

#Ask for a project update
	echo "Update"
	boinccmd --project "$PROJECT" update

#Pause for twenty eight seconds (total of thirty per loop through)
	sleep 28

done
Same as before, change the "PROJECT=" line to the project being refreshed, remove the two "echo" commands if you don't want to see anything and change the second delay to accommodate different minimum refresh times for different projects.

Create the file in your home directory (the one you start in when opening terminal) and save it as "bunker" (change as you wish but also modify the following instructions) -

Code: Select all

sudo gedit bunker
Linux is a bit more picky about file locations and permissions. These can be handled in a graphical environment but since there's quite a few and they do things differently, I'm sticking to the terminal commands.
Allow it to execute -

Code: Select all

sudo chmod 755 bunker
Move the file to the "bin" sub-directory of your home directory where Linux expects to find user executables -

Code: Select all

mv bunker bin
There shouldn't need to be a need to copy the boinccmd file as it should already be on the path.

Close terminal.

To use, open terminal, type "bunker" (no quotes)

**** This is currently from memory, I don't have a Linux system here to test it on but I'll do so tonight and amend if necessary ****

Mark

Woodles
Active UBT Contributor 20+ yrs
Posts: 9892
Joined: Thu Dec 20, 2007 12:00 am
Location: Cambridgeshire

Re: Automating bunker filling

Post by Woodles » Wed Oct 30, 2019 10:34 am

If you want values set from the command line instead of altering the file

Code: Select all

#!/bin/bash

while true
do
	echo "Retry"
	boinccmd --network_available

	sleep 2

	echo "Update"
	boinccmd --project "$1" update

	sleep $2

done
Called by -

Code: Select all

 bunker projectURL loop-time
ie

Code: Select all

bunker https://rake.boincfast.ru/rakesearch/ 28
To match the above.

UBT - Timbo
UBT Forum Admin
Posts: 7524
Joined: Mon Mar 13, 2006 12:00 am
Location: NW Midlands
Contact:

Re: Automating bunker filling

Post by UBT - Timbo » Wed Oct 30, 2019 11:27 am

Hi Mark

re: DOS version

As I recall, one can also pass a "project URL" into the batch file using the "%1" parameter

So:

Code: Select all

SET PROJECT=https://rake.boincfast.ru/rakesearch/
becomes

Code: Select all

SET PROJECT=%1
and then you can start the batch file with:
So, this means you can have ONE batch file for ANY bunkering event.

I might be a bit rusty on DOS command line stuff, but I think this is right.


OR:

One could simply create specific batch files for each and every project and just edit and rename each batch file to relate to each project:

eg:

bunkerseti
bunkerrosetta
bunkerrakesearch

and with each differing by the SET PROJECT URL.

regards
Tim

Woodles
Active UBT Contributor 20+ yrs
Posts: 9892
Joined: Thu Dec 20, 2007 12:00 am
Location: Cambridgeshire

Re: Automating bunker filling

Post by Woodles » Wed Oct 30, 2019 1:40 pm

Hi Tim,

Indeed and I've added that to the Linux version.

I've had a quick go at an easier set-and-forget DOS version:

Code: Select all

@echo off
setlocal enableextensions enabledelayedexpansion
SET PROJECT=http://gerasim.boinc.ru/
SET BOINCDATA=C:\Mark\ProgramData\BOINC\
SET LOOPTIME=30

::Get the parameters
IF "%~1" NEQ "" (SET PROJECT=%~1)
IF "%~2" NEQ "" (SET BOINCDATA=%~2)
IF "%~3" NEQ "" (SET LOOPTIME=%~3)

::Execution
SET /a LOOPTIME=LOOPTIME-2
:START
::Do any file retries
boinccmd --network_available

::Pause for two seconds
TIMEOUT /T 2 >NUL

::Ask for a project update
boinccmd --project "%PROJECT%" update

:Check if we're full
findstr /C:"job cache full" /I %BOINCDATA%stdoutdae.txt > Nul
IF "%ERRORLEVEL%"=="0" (
	ECHO Finished, turning network off
	boinccmd --set_network_mode never
) ELSE (
	ECHO More files needed
::Pause then repeat
	TIMEOUT /T %LOOPTIME% >NUL
	GOTO START
)

EXIT
Called similar to the Linux one -

Code: Select all

bunker projectURL path-to-boinccmd looptime
except that boinccmd doesn't need to be copied (just the path specified) and if any parameter is missing then the local one in the file is used instead. To skip a parameter, enter empty quotes.

Retries any pending file transfers, asks for more work then either repeats or, if the cache is full, exits and disables the network.

So

Code: Select all

bunker https://setiathome.berkeley.edu/ "" 120
to update SETI every 2 minutes and

Code: Select all

bunker http://asteroidsathome.net/boinc/
to update Asteroids every 30 seconds.

Or bunker_seti and bunker_asteroids with the defaults changed :)

Mark

Post Reply