Safe Shutdown

Message boards : Number crunching : Safe Shutdown
Message board moderation

To post messages, you must log in.

AuthorMessage
Profile RueiKe Special Project $250 donor
Volunteer tester
Avatar

Send message
Joined: 14 Feb 16
Posts: 492
Credit: 378,512,430
RAC: 785
Taiwan
Message 1832822 - Posted: 27 Nov 2016, 9:45:46 UTC

With my recent power distribution upgrades, I now have Network Management Cards in all of my UPS. This allows me to trigger system shutdown in the case of low battery when power is interrupted. I attempted this, but it looks like a shutdown while BOINC is running will stop the BOINC Manager before powering down the computer, but it appears as though MB processes are still running. You can see this behavior in the video I just posted https://youtu.be/uWBNdLmN6QY Does anyone have a script that will shutdown BOINC Manager and wait for all relevant processes to end before exiting?
GitHub: Ricks-Lab
Instagram: ricks_labs
ID: 1832822 · Report as offensive
Richard Haselgrove Project Donor
Volunteer tester

Send message
Joined: 4 Jul 99
Posts: 14649
Credit: 200,643,578
RAC: 874
United Kingdom
Message 1832824 - Posted: 27 Nov 2016, 10:00:12 UTC - in response to Message 1832822.  

It's not the Manager you have to worry about, but the underlying client (boinc.exe)

The most easily scriptable closedown would be

[BOINC program directory] boinccmd.exe --quit
ID: 1832824 · Report as offensive
Profile Shaggie76
Avatar

Send message
Joined: 9 Oct 09
Posts: 282
Credit: 271,858,118
RAC: 196
Canada
Message 1832845 - Posted: 27 Nov 2016, 13:27:39 UTC

This is what I use for my daily shutdown when the price of electricity goes up

@echo off
"C:\Program Files\BOINC\boinccmd.exe" --project http://setiathome.berkeley.edu update
timeout /t 300
"C:\Program Files\BOINC\boinccmd.exe" --set_run_mode never 300
timeout /t 10
"C:\Windows\System32\shutdown.exe" /p /f

I like to do one last project update before shutting down in the hopes that it'll flush through any pending uploads, then I ask BOINC nicely to stop for 5 minutes, I give it 10 seconds to respond, then I shut it down. When it comes back to life it's back to default run mode (probably "always").
ID: 1832845 · Report as offensive
Richard Haselgrove Project Donor
Volunteer tester

Send message
Joined: 4 Jul 99
Posts: 14649
Credit: 200,643,578
RAC: 874
United Kingdom
Message 1832847 - Posted: 27 Nov 2016, 13:49:32 UTC - in response to Message 1832845.  

In my case, that would be
D:\BOINC\boinccmd.exe --set_run_mode never 300

and so on - no quotation marks, because I deliberately choose an installation path without any embedded spaces.

For subsequent readers - remember "C:\Program Files\BOINC\" is an installation time (default) choice - YMMV.
ID: 1832847 · Report as offensive
OzzFan Crowdfunding Project Donor*Special Project $75 donorSpecial Project $250 donor
Volunteer tester
Avatar

Send message
Joined: 9 Apr 02
Posts: 15691
Credit: 84,761,841
RAC: 28
United States
Message 1832960 - Posted: 28 Nov 2016, 3:51:02 UTC

I wrote this Powershell script if it helps:

$path = (Get-ItemProperty -Path "HKLM:\Software\Space Sciences Laboratory, U.C. Berkeley\BOINC Setup").INSTALLDIR -Replace ".{1}$"
if (Test-Path -Literalpath '$path\boinccmd.exe')
    {
    & "$path\boinccmd.exe" --project http://setiathome.berkeley.edu update
    & "$path\boinccmd.exe" --set_run_mode never 300
    }


This will pull the install directory from the registry and execute an update, then set run mode to never for 5 minutes so you can shutdown the system. Simply copy and paste this into a text file editor (or Powershell ISE), save it and give it an extestion of .ps1, then run it as needed.
ID: 1832960 · Report as offensive
Profile HAL9000
Volunteer tester
Avatar

Send message
Joined: 11 Sep 99
Posts: 6534
Credit: 196,805,888
RAC: 57
United States
Message 1832980 - Posted: 28 Nov 2016, 7:57:10 UTC

When I was running ~30 machines. many of them rack servers, I used the UPS management software to control BOINC via boinccmd.
I setup one machine per UPS to handle the events. Which would handle BOINC for all on the systems on the given UPS. So it would be the last to shutdown & first to power on.
From memory I had set it up along the lines of:
On battery > 60 seconds: boinccmd --set_run_mode mode duration never 1200
On battery > 300 seconds: boinccmd --set_run_mode mode duration never
On battery > 900 seconds: Do a system shutdown
On AC > 600 seconds: boinccmd --set_run_mode mode duration auto

Each .bat would be something like :
@ECHO OFF
pushd %~dp0
set cmdpath=D:\BOINC\boinccmd
set pass=password
set cmd=--passwd %pass% --set_run_mode mode duration never 1200
%cmdpath% --host NODE1 %cmd%
%cmdpath% --host NODE2 %cmd%
%cmdpath% --host NODE3 %cmd%
%cmdpath% --host NODE4 %cmd%
%cmdpath% --host NODE5 %cmd%
exit

SETI@home classic workunits: 93,865 CPU time: 863,447 hours
Join the [url=http://tinyurl.com/8y46zvu]BP6/VP6 User Group[
ID: 1832980 · Report as offensive
Profile RueiKe Special Project $250 donor
Volunteer tester
Avatar

Send message
Joined: 14 Feb 16
Posts: 492
Credit: 378,512,430
RAC: 785
Taiwan
Message 1833001 - Posted: 28 Nov 2016, 12:37:01 UTC

Thanks everyone who provided input. Based on the examples given, here is what I implemented. I had to use a longer timeout after set_run_mode since I am also running Atlas@Home, and it takes longer for Atlas tasks to end.
@echo off
echo "UPS Low battery shutdown script execution"

"C:\Program Files\BOINC\boinccmd.exe" --set_run_mode never 300
timeout /t 35
"C:\Program Files\BOINC\boinccmd.exe" --quit
timeout /t 2

echo "Shutting down..."
exit

GitHub: Ricks-Lab
Instagram: ricks_labs
ID: 1833001 · Report as offensive
Profile RueiKe Special Project $250 donor
Volunteer tester
Avatar

Send message
Joined: 14 Feb 16
Posts: 492
Credit: 378,512,430
RAC: 785
Taiwan
Message 1833010 - Posted: 28 Nov 2016, 13:50:24 UTC - in response to Message 1832980.  

When I was running ~30 machines. many of them rack servers, I used the UPS management software to control BOINC via boinccmd.
I setup one machine per UPS to handle the events. Which would handle BOINC for all on the systems on the given UPS. So it would be the last to shutdown & first to power on.
From memory I had set it up along the lines of:
On battery > 60 seconds: boinccmd --set_run_mode mode duration never 1200
On battery > 300 seconds: boinccmd --set_run_mode mode duration never
On battery > 900 seconds: Do a system shutdown
On AC > 600 seconds: boinccmd --set_run_mode mode duration auto


Were you using a generic UPS management tool or something from the UPS maker? I assume that with SNMP protocol, it would be possible to develop alternative tools for this. The software that came with my UPS network management card doesn't seem to have the flexibility that you described., so I am looking for an alternative.
GitHub: Ricks-Lab
Instagram: ricks_labs
ID: 1833010 · Report as offensive
Profile BilBg
Volunteer tester
Avatar

Send message
Joined: 27 May 07
Posts: 3720
Credit: 9,385,827
RAC: 0
Bulgaria
Message 1833022 - Posted: 28 Nov 2016, 15:35:07 UTC - in response to Message 1833010.  
Last modified: 28 Nov 2016, 15:38:38 UTC

No need for "UPS network management"
boinccmd itself can access LAN
In the line:
%cmdpath% --host NODE1 %cmd%

"NODE1" is the name or IP of computer on LAN
http://boinc.berkeley.edu/wiki/Boinccmd_tool

That computer's BOINC have to allow remote access:
http://boinc.berkeley.edu/wiki/Controlling_BOINC_remotely
 


- ALF - "Find out what you don't do well ..... then don't do it!" :)
 
ID: 1833022 · Report as offensive
Profile HAL9000
Volunteer tester
Avatar

Send message
Joined: 11 Sep 99
Posts: 6534
Credit: 196,805,888
RAC: 57
United States
Message 1833042 - Posted: 28 Nov 2016, 18:26:10 UTC - in response to Message 1833010.  

When I was running ~30 machines. many of them rack servers, I used the UPS management software to control BOINC via boinccmd.
I setup one machine per UPS to handle the events. Which would handle BOINC for all on the systems on the given UPS. So it would be the last to shutdown & first to power on.
From memory I had set it up along the lines of:
On battery > 60 seconds: boinccmd --set_run_mode mode duration never 1200
On battery > 300 seconds: boinccmd --set_run_mode mode duration never
On battery > 900 seconds: Do a system shutdown
On AC > 600 seconds: boinccmd --set_run_mode mode duration auto


Were you using a generic UPS management tool or something from the UPS maker? I assume that with SNMP protocol, it would be possible to develop alternative tools for this. The software that came with my UPS network management card doesn't seem to have the flexibility that you described., so I am looking for an alternative.

The software I was using was the enterprise or business versions of whatever APC provides. I would imagine there is probably some very similar free or open source software that has most of the same functionality for any SNMP UPS device. The UPSs that I had could also send IPMI off/on commands. So I used the UPS firmware to control the boot order for the systems.
SETI@home classic workunits: 93,865 CPU time: 863,447 hours
Join the [url=http://tinyurl.com/8y46zvu]BP6/VP6 User Group[
ID: 1833042 · Report as offensive

Message boards : Number crunching : Safe Shutdown


 
©2024 University of California
 
SETI@home and Astropulse are funded by grants from the National Science Foundation, NASA, and donations from SETI@home volunteers. AstroPulse is funded in part by the NSF through grant AST-0307956.