Index  | Recent Threads  | Unanswered Threads  | Who's Active  | Guidelines  | Search
 

Quick Go »
No member browsing this thread
Thread Status: Active
Total posts in this thread: 13
Posts: 13   Pages: 2   [ Previous Page | 1 2 ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 4220 times and has 12 replies Next Thread
VinceLewis
Cruncher
Joined: May 13, 2020
Post Count: 7
Status: Offline
Reply to this Post  Reply with Quote 
Re: An option to force a checkpoint would be invaluable

Okay so my server is an HP proliant DL385 and does not allow for suspend or hibernate. I'm running ubuntu on it.

So I went away and wrote a small bash script to run in the evening to wait for the ARP unit to go past the next checkpoint, then poweroff.

Here's my script if it helps anyone. Note that I currently only allow for 1 ARP unit at a time, so the script would need an update to cater for more than 1.

#!/bin/bash

# find the africa rainfall project. It checkpoints every 12.5%. Need to ensure we don't can it before it's checkpointed
a=`boinccmd --get_tasks | grep "name: ARP" -A15 | grep "active_task_state: EXECUTING" -A9 | grep "CPU time at last checkpoint: " | grep -Eo '[+-]?[0-9]+([.][0-9]+)?'`

if [ -z "$a"]
then
echo "No africa rainforest project running, powering off now"
/sbin/poweroff
exit 0
fi

echo "Original checkpoint time at $a seconds. Waiting for that to change indicating a new checkpoint"

b=`boinccmd --get_tasks | grep "name: ARP" -A15 | grep "active_task_state: EXECUTING" -A9 | grep "CPU time at last checkpoint: " | grep -Eo '[+-]?[0-9]+([.][0-9]+)?'`
until [ 0 -eq "$(echo "${b} == ${a}" | bc)" ]
do
sleep 120
b=`boinccmd --get_tasks | grep "name: ARP" -A15 | grep "active_task_state: EXECUTING" -A9 | grep "CPU time at last checkpoint: " | grep -Eo '[+-]?[0-9]+([.][0-9]+)?'`
done

echo "New checkpoint at $b seconds, all done :-)"
/sbin/poweroff
[Dec 2, 2020 9:06:06 AM]   Link   Report threatening or abusive post: please login first  Go to top 
adriverhoef
Master Cruncher
The Netherlands
Joined: Apr 3, 2009
Post Count: 2346
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: An option to force a checkpoint would be invaluable

Yes, great script, VinceLewis;
another approach would be to look at the latest checkpoint using 'wcgresults':

until wcgresults -HNLr | grep '^ 0:0[012]:[0-5][0-9].ARP1_' && echo poweroff; do sleep 120; done

(If the latest checkpoint was within 3 minutes ago (allowing for a few seconds overshooting 120 seconds), power off.)

(Remove 'echo' to get the real experience.) laughing

Also, if you want to check if any ARP1 is already running before you enter the main loop, you could use this little thingy:

wcgresults -HNr | grep ^ARP1 || echo poweroff

(Remove 'echo' to get the real experience.) laughing
----------------------------------------
[Edit 3 times, last edit by adriverhoef at Dec 2, 2020 3:05:45 PM]
[Dec 2, 2020 10:43:06 AM]   Link   Report threatening or abusive post: please login first  Go to top 
VinceLewis
Cruncher
Joined: May 13, 2020
Post Count: 7
Status: Offline
Reply to this Post  Reply with Quote 
Re: An option to force a checkpoint would be invaluable

got to love a 1 line script.
My comedy moment today - not had any ARP work units for the day smile
[Dec 2, 2020 4:02:46 PM]   Link   Report threatening or abusive post: please login first  Go to top 
Posts: 13   Pages: 2   [ Previous Page | 1 2 ]
[ Jump to Last Post ]
Post new Thread