Message boards :
Number crunching :
Shutting down pc
Message board moderation
Previous · 1 · 2 · 3 · Next
| Author | Message |
|---|---|
|
Zapiao Send message Joined: 29 Oct 01 Posts: 110 Credit: 122,278 RAC: 0
|
No, you can name it actually whatever you want, I used the names just so everyone knows what is intended for his operating system, I didn't think at that moment to write next to the name, that it's also for Vista. Can't edit it now anymore. Ok. THANK YOU VERY MUCH for your help!!!!!!!!!!!!!! By your command !!! |
Link Send message Joined: 18 Sep 03 Posts: 833 Credit: 1,807,369 RAC: 1
|
No, you can name it actually whatever you want, I used the names just so everyone knows what is intended for his operating system, I didn't think at that moment to write next to the name, that it's also for Vista. Can't edit it now anymore. The last 1 (I assume you mean the one after /t) is 1 second shutdown delay. You can change it to any value between 0 and 315360000 (10 years), I've set it to 1, since I didn't see any reason to wait the default 30 seconds, we have wait 2 minutes anyway.
|
|
Zapiao Send message Joined: 29 Oct 01 Posts: 110 Credit: 122,278 RAC: 0
|
So why it doesnt shutdown the pc? IT WORKS !!!!!!!!!!!!!!!!! THANK YOU VERY MUCH my european neighbour for your help. Ps: do i have to change to "autoshutdown_winvista.bat" since i have vista? And the last "1" means 1 minute? Can i change to other value, 2 or 3? By your command !!! |
Link Send message Joined: 18 Sep 03 Posts: 833 Credit: 1,807,369 RAC: 1
|
So why it doesnt shutdown the pc? I edited my previous post with more exact information.
|
|
Zapiao Send message Joined: 29 Oct 01 Posts: 110 Credit: 122,278 RAC: 0
|
So why it doesnt shutdown the pc? By your command !!! |
Link Send message Joined: 18 Sep 03 Posts: 833 Credit: 1,807,369 RAC: 1
|
I just stopped boinc and it still saying boinc running.... Well... yes. It's not done for that, it's just checking if some of the slot directories are in use, not if the BOINC client or any of the apps is actually still running. The BOINC client won't exit when all WUs are completed anyway, only the files from the slot directories are deleted and that's what we are checking.
|
|
Zapiao Send message Joined: 29 Oct 01 Posts: 110 Credit: 122,278 RAC: 0
|
I just stopped boinc and it still saying boinc running.... By your command !!! |
Link Send message Joined: 18 Sep 03 Posts: 833 Credit: 1,807,369 RAC: 1
|
Thanks for your help guys but where i put that batch? When i open that file it opens a window with date, time and "boinc running" list. What am i missing? Nothing. If it's telling you every 5 minutes, that BOINC is running, than it means it works. You can have the file wherever you want, for example on the desktop.
|
|
Zapiao Send message Joined: 29 Oct 01 Posts: 110 Credit: 122,278 RAC: 0
|
Thanks for your help guys but where i put that batch? When i open that file it opens a window with date, time and "boinc running" list. What am i missing? By your command !!! |
Link Send message Joined: 18 Sep 03 Posts: 833 Credit: 1,807,369 RAC: 1
|
Here batch files for Windows 7 (should work on Vista too) & Windows XP. The first one shuts the sytem down, the second one hibernates it, depends on what you prefer. No additional programs like sleep.exe needed. autoshutdown_win7.bat @echo off :: - Change that directory to your BOINC data directory: pushd "%programdata%\BOINC\slots\" if exist "..\client_state.xml" goto check_folders echo This is not your BOINC data directory! pause exit :boinc_running echo %date% %time% BOINC running. ping 1.1.1.1 -n 1 -w 300000>NUL :check_folders for /r %%a in (boinc_lock*) do goto boinc_running echo %date% %time% boinc_lockfile not found, waiting 60 seconds... ping 1.1.1.1 -n 1 -w 60000>NUL for /r %%a in (boinc_lock*) do goto boinc_running echo %date% %time% boinc_lockfile not found, waiting 60 seconds again... ping 1.1.1.1 -n 1 -w 60000>NUL for /r %%a in (boinc_lock*) do goto boinc_running popd echo %date% %time% No active WUs, shuting down.>>autoshutdown.txt shutdown /s /t 1 autohibernate_win7.bat @echo off :: - Change that directory to your BOINC data directory: pushd "%programdata%\BOINC\slots\" if exist "..\client_state.xml" goto check_folders echo This is not your BOINC data directory! pause exit :boinc_running echo %date% %time% BOINC running. ping 1.1.1.1 -n 1 -w 300000>NUL :check_folders for /r %%a in (boinc_lock*) do goto boinc_running echo %date% %time% boinc_lockfile not found, waiting 60 seconds... ping 1.1.1.1 -n 1 -w 60000>NUL for /r %%a in (boinc_lock*) do goto boinc_running echo %date% %time% boinc_lockfile not found, waiting 60 seconds again... ping 1.1.1.1 -n 1 -w 60000>NUL for /r %%a in (boinc_lock*) do goto boinc_running popd echo %date% %time% No active WUs, entering hibernation mode.>>autohibernate.txt shutdown /h /t 1 autoshutdown_winxp.bat @echo off :: - Change that directory to your BOINC data directory: pushd "%ALLUSERSPROFILE%\Application Data\BOINC\slots\" if exist "..\client_state.xml" goto check_folders echo This is not your BOINC data directory! pause exit :boinc_running echo %date% %time% BOINC running. ping 1.1.1.1 -n 1 -w 300000>NUL :check_folders for /r %%a in (boinc_lock*) do goto boinc_running echo %date% %time% boinc_lockfile not found, waiting 60 seconds... ping 1.1.1.1 -n 1 -w 60000>NUL for /r %%a in (boinc_lock*) do goto boinc_running echo %date% %time% boinc_lockfile not found, waiting 60 seconds again... ping 1.1.1.1 -n 1 -w 60000>NUL for /r %%a in (boinc_lock*) do goto boinc_running popd echo %date% %time% No active WUs, shuting down.>>autoshutdown.txt shutdown -s -t 1 autohibernate_winxp.bat @echo off :: - Change that directory to your BOINC data directory: pushd "%ALLUSERSPROFILE%\Application Data\BOINC\slots\" if exist "..\client_state.xml" goto check_folders echo This is not your BOINC data directory! pause exit :boinc_running echo %date% %time% BOINC running. ping 1.1.1.1 -n 1 -w 300000>NUL :check_folders for /r %%a in (boinc_lock*) do goto boinc_running echo %date% %time% boinc_lockfile not found, waiting 60 seconds... ping 1.1.1.1 -n 1 -w 60000>NUL for /r %%a in (boinc_lock*) do goto boinc_running echo %date% %time% boinc_lockfile not found, waiting 60 seconds again... ping 1.1.1.1 -n 1 -w 60000>NUL for /r %%a in (boinc_lock*) do goto boinc_running popd echo %date% %time% No active WUs, entering hibernation mode.>>autohibernate.txt rundll32.exe powrprof.dll,SetSuspendState Except for the shutdown/hibernate command they are tested (can't shutdown my system right now). If you have installed BOINC with default dirs, you should not need to change anything. If you use a custom data directory, replace the default dir with it's full path. On WinXP I'm not sure, the german version uses "Anwendungsdaten" instead of "Application Data", maybe someone can confirm this path. %programdata% is unfortunately not available under WinXP. So this batch files are not really "final" more "release candidates", keep that in mind when using them. BTW @BilBg: why are we pinging something in Australia? EDIT: updated Win7 versions and added those for WinXP.
|
janneseti Send message Joined: 14 Oct 09 Posts: 14106 Credit: 655,366 RAC: 0
|
Well, it depends who you configure your task in the scheduler. There are a lot of options to consider. But that's not an easy thing to do. So your solution to use sleep and expand the script are probably the most acceptable one. |
Link Send message Joined: 18 Sep 03 Posts: 833 Credit: 1,807,369 RAC: 1
|
Boinc could also be installed somewhere else which would lead to shutting down if that check is not done. The real issue with using the scheduler, which will occur every time you use this script is in my previous post. That was the reason, why I used sleep.exe.
|
janneseti Send message Joined: 14 Oct 09 Posts: 14106 Credit: 655,366 RAC: 0
|
Thanks. Boinc could also be installed somewhere else which would lead to shutting down if that check is not done. |
Link Send message Joined: 18 Sep 03 Posts: 833 Credit: 1,807,369 RAC: 1
|
Can you check will this work?: No, it doesn't. It's not an error if "find" finds boinc_lockfile 0 times, it's a number like any other, so the errorlevel is 0 in any case. We would have to use the output and if that's 0, than we know we have no boinc_lockfile files left. I'll eventually look more at that later (or tomorrow), the idea is good, since you don't have to care anymore about how many slots to check. I like the idea of checking the dir and the ping thing, that should make it easier for others to get this to work. EDIT: OK, for /r %programdata%\boinc\slots %%i in (*lockfile) do goto boinc_running is the best solution. However I think you can't use the scheduler for that. After the machine has been shut down by this script, when the user starts it up again, it is still out of work, so it will shut down again.
|
BilBg Send message Joined: 27 May 07 Posts: 3720 Credit: 9,385,827 RAC: 0
|
Another way to do it could be like this: OK, that's short. But add some check that BOINC files are really there - else the shutdown will happen immediately if BOINC do not exist (which may happen if this file is (forgotten) in Windows Task Scheduler and user deletes/moves BOINC dir) @echo off IF NOT EXIST "%programdata%\boinc\client_state.xml" Exit for /r %programdata%\boinc\slots %%i in (*lockfile) do goto boinc_running echo %date% %time% No active WUs, shutting down. >>autoshutdown.txt shutdown /s /f exit :boinc_running echo %date% %time% BOINC running. >>autoshutdown.txt - ALF - "Find out what you don't do well ..... then don't do it!" :) |
janneseti Send message Joined: 14 Oct 09 Posts: 14106 Credit: 655,366 RAC: 0
|
Another way to do it could be like this: @echo off for /r %programdata%\boinc\slots %%i in (*lockfile) do goto boinc_running echo %date% %time% No active WUs, shutting down. >>autoshutdown.txt shutdown /s /f exit :boinc_running echo %date% %time% BOINC running. >>autoshutdown.txt To make it repeat itself you could use Windows Task Scheduler. |
BilBg Send message Joined: 27 May 07 Posts: 3720 Credit: 9,385,827 RAC: 0
|
Well, there is shutdown.exe, but I don't know how you might trigger it based on Boinc doing work or not. Can you check will this work?: (It does not use 'sleep' but Ping which is available on every Windows. Tries to find "boinc_lockfile" in all slots. !!! - I'm Not sure about the 'ERRORLEVEL 1' - Not tested !!! ) @echo off :: !!! - I'm Not sure about the 'ERRORLEVEL 1' - Not tested !!! echo --- Use Ctrl+C to stop this script --- :: - Change that directory to yours: pushd "C:\ProgramData\BOINC\slots\" IF NOT EXIST "..\client_state.xml" goto ErrDir goto check_folders :boinc_running :: - Pause for 5 minutes (5*60*1000 milliseconds) echo %date% %time% - BOINC is running - Waiting 5 minutes to check again ... Ping 1.1.1.1 -n 1 -w 300000 >NUL :check_folders dir /s boinc_lockfile | find /c /i "boinc_lockfile" IF ERRORLEVEL 1 goto boinc_running echo %date% %time% boinc_lockfile not found, waiting 60 seconds... Ping 1.1.1.1 -n 1 -w 60000 >NUL dir /s boinc_lockfile | find /c /i "boinc_lockfile" IF ERRORLEVEL 1 goto boinc_running echo %date% %time% boinc_lockfile not found, waiting 60 seconds again... Ping 1.1.1.1 -n 1 -w 60000 >NUL dir /s boinc_lockfile | find /c /i "boinc_lockfile" IF ERRORLEVEL 1 goto boinc_running POPD echo %date% %time% No active WUs, shutting down. >>autoshutdown.txt echo %date% %time% No active WUs, shutting down. shutdown -s -t 1 Echo --- 'shutdown' command failed or do not exist on this computer. Pause goto End :ErrDir Echo --- ! This is not your BOINC Data directory! :End - ALF - "Find out what you don't do well ..... then don't do it!" :) |
Link Send message Joined: 18 Sep 03 Posts: 833 Credit: 1,807,369 RAC: 1
|
Thanks. Yes, it needs to be tested a little more, I used it so far only on Windows XP (with different file paths). If it works, I can write a more complete instructions, which could also include hibernating the system insted of shuting down. Do we have some special place to post such tutorials? In the "normal" Q&A area it won't be much more easy to find it after a while than here. EDIT: I just checked the shutdown help on Windows 7, it might be necessary to change the last line to shutdown /s /t 1 But I'm not sure about it yet, will check tonight, when I'll turn off my Win 7 PC. Maybe it accepts - instead of / too. The /t parameter is optional BTW.
|
rob smith ![]() Send message Joined: 7 Mar 03 Posts: 18644 Credit: 416,307,556 RAC: 863
|
Link, That's a nice one, needs to be tested, but worthy of being put into Q&A if it works well. Bob Smith Member of Seti PIPPS (Pluto is a Planet Protest Society) Somewhere in the (un)known Universe? |
Link Send message Joined: 18 Sep 03 Posts: 833 Credit: 1,807,369 RAC: 1
|
So I assume you mean this computer. 1. Locate the BOINC data directory. It *should* be C:\ProgramData\BOINC if you didn't change that during the installation, you can see that at the beginning of BOINC log (it's called event log or something like that in the newer BOINC versions). The directory is hidden, so type the path in windows explorer to get in there (unless you enabled showing hidden files/directories). 2. Copy the code from my previous post to Notepad (or any other plain text editor) and save it as autoshutdown.bat (NOT .txt file, choose "all files" from the drop down menu), preferably on your desktop. If the BOINC data directory is different from the one posted above, you'll have to change it in the file. The easiest way to do that would be to go into the slots directory, open the properties of one of the slot directory (0, 1,...) and copy the path from there and replace all instances of C:\ProgramData\BOINC\slots with it. Since this is only a dual core machine without a GPU, I don't think any other adjustments are necessary. 3. Download and install the Ressource Kit. In the installation directory you'll find a file called sleep.exe. Copy that file to your Windows dirctory, usually C:\WINDOWS. 4. Hmm... I think that was all. Now you can run the .bat file. If you want to try it without the risk of the machine shuting down in case something is wrong, remove the last line from the bat file. I'd actually recommend that. If everything is OK, you should see every 5 minutes a new message, that BOINC is running. If something is still not clear, just ask, I tend sometimes to skip some steps in my explanations without that I notice it.
|
©2020 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.