Requesting some magic from Windows batch script wizards... :D
For competition purposes, members of my team use BoincTasks to automatically suspend Boinc workunits at 99% completion, thus they can resume them after a starting dateline, sending a lot of results in a short time. Unfortunately, BoincTasks can automatically suspend tasks, but can't resume them automatically. So : in case the user can't stay in front of the computer at a certain date/time to manually resume tasks, it would be nice to have a Windows batch script being able to do the job, triggered by the Windows scheduler.
Boinc uses a (false) .XML file to keep tracks of any task he manages. Usually, you'll find it here : C:\ProgramData\BOINC\client_state.xml
Here's the interesting part of it (full file is 368k) :
<active_task>
<project_master_url>http://asteroidsathome.net/boinc/</project_master_url>
<result_name>ps_170405_input_161867_8_1</result_name>
<active_task_state>1</active_task_state>
...
</active_task>
There's an "active_task" tag for each task. Suspended tasks have the "active_task_state" subtag set to "0".
Boinc has a command line executable that can resume a single task, presuming you know some parameters. Here's an example :
boinccmd --task [project_master_url] [result_name] resume
So, I'd like to write a batch script being able to resume suspended tasks from a chosen "project_master_url". Here's the ideal scenario : I'd like to resume all the tasks from the "asteroidsathome" Boinc project (see the url in the code above).
- Open and parse "C:\ProgramData\BOINC\client_state.xml" ;
- find all the "active_task" branches having
"project_master_url"=="the project url"
AND"active_task_state"==0
; - for each task, execute the command line, as stated above.
I'm quite used to Linux .sh and PHP scripts, but I just do not understand how to obtain the same result in Windows batch. I've found how to parse the XML using this : parsing xml from batch ... But the "filtering/throwing the extracted data to a command line" process remains a mystery :(
Some spells to cast ? Thanks :D