Shutting down pc

Message boards : Number crunching : Shutting down pc
Message board moderation

To post messages, you must log in.

Previous · 1 · 2 · 3 · Next

AuthorMessage
Zapiao
Volunteer tester

Send message
Joined: 29 Oct 01
Posts: 110
Credit: 122,278
RAC: 0
Portugal
Message 1277805 - Posted: 30 Aug 2012, 22:19:52 UTC - in response to Message 1277803.  

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.

Ok. THANK YOU VERY MUCH for your help!!!!!!!!!!!!!!
By your command !!!
ID: 1277805 · Report as offensive
Profile Link
Avatar

Send message
Joined: 18 Sep 03
Posts: 833
Credit: 1,807,369
RAC: 1
Germany
Message 1277803 - Posted: 30 Aug 2012, 22:08:06 UTC - in response to Message 1277799.  
Last modified: 30 Aug 2012, 22:13:12 UTC

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.
ID: 1277803 · Report as offensive
Zapiao
Volunteer tester

Send message
Joined: 29 Oct 01
Posts: 110
Credit: 122,278
RAC: 0
Portugal
Message 1277799 - Posted: 30 Aug 2012, 21:57:54 UTC - in response to Message 1277795.  
Last modified: 30 Aug 2012, 22:04:56 UTC

So why it doesnt shutdown the pc?

I edited my previous post with more exact information.

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 !!!
ID: 1277799 · Report as offensive
Profile Link
Avatar

Send message
Joined: 18 Sep 03
Posts: 833
Credit: 1,807,369
RAC: 1
Germany
Message 1277795 - Posted: 30 Aug 2012, 21:53:06 UTC - in response to Message 1277792.  

So why it doesnt shutdown the pc?

I edited my previous post with more exact information.
ID: 1277795 · Report as offensive
Zapiao
Volunteer tester

Send message
Joined: 29 Oct 01
Posts: 110
Credit: 122,278
RAC: 0
Portugal
Message 1277792 - Posted: 30 Aug 2012, 21:50:56 UTC

So why it doesnt shutdown the pc?
By your command !!!
ID: 1277792 · Report as offensive
Profile Link
Avatar

Send message
Joined: 18 Sep 03
Posts: 833
Credit: 1,807,369
RAC: 1
Germany
Message 1277789 - Posted: 30 Aug 2012, 21:48:59 UTC - in response to Message 1277786.  
Last modified: 30 Aug 2012, 21:50:46 UTC

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.
ID: 1277789 · Report as offensive
Zapiao
Volunteer tester

Send message
Joined: 29 Oct 01
Posts: 110
Credit: 122,278
RAC: 0
Portugal
Message 1277786 - Posted: 30 Aug 2012, 21:39:08 UTC - in response to Message 1277783.  


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.

I just stopped boinc and it still saying boinc running....
By your command !!!
ID: 1277786 · Report as offensive
Profile Link
Avatar

Send message
Joined: 18 Sep 03
Posts: 833
Credit: 1,807,369
RAC: 1
Germany
Message 1277783 - Posted: 30 Aug 2012, 21:36:31 UTC - in response to Message 1277779.  

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.
ID: 1277783 · Report as offensive
Zapiao
Volunteer tester

Send message
Joined: 29 Oct 01
Posts: 110
Credit: 122,278
RAC: 0
Portugal
Message 1277779 - Posted: 30 Aug 2012, 21:31:28 UTC

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 !!!
ID: 1277779 · Report as offensive
Profile Link
Avatar

Send message
Joined: 18 Sep 03
Posts: 833
Credit: 1,807,369
RAC: 1
Germany
Message 1277723 - Posted: 30 Aug 2012, 18:58:57 UTC
Last modified: 30 Aug 2012, 19:37:46 UTC

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.
ID: 1277723 · Report as offensive
Profile janneseti
Avatar

Send message
Joined: 14 Oct 09
Posts: 14106
Credit: 655,366
RAC: 0
Sweden
Message 1276732 - Posted: 28 Aug 2012, 15:10:52 UTC - in response to Message 1276698.  


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.


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.

ID: 1276732 · Report as offensive
Profile Link
Avatar

Send message
Joined: 18 Sep 03
Posts: 833
Credit: 1,807,369
RAC: 1
Germany
Message 1276719 - Posted: 28 Aug 2012, 14:54:52 UTC - in response to Message 1276713.  

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.
ID: 1276719 · Report as offensive
Profile janneseti
Avatar

Send message
Joined: 14 Oct 09
Posts: 14106
Credit: 655,366
RAC: 0
Sweden
Message 1276713 - Posted: 28 Aug 2012, 14:46:13 UTC - in response to Message 1276681.  

Thanks.
Boinc could also be installed somewhere else which would lead to shutting down if that check is not done.
ID: 1276713 · Report as offensive
Profile Link
Avatar

Send message
Joined: 18 Sep 03
Posts: 833
Credit: 1,807,369
RAC: 1
Germany
Message 1276698 - Posted: 28 Aug 2012, 14:30:24 UTC - in response to Message 1276671.  
Last modified: 28 Aug 2012, 14:45:31 UTC

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 !!!
)

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.
ID: 1276698 · Report as offensive
Profile BilBg
Volunteer tester
Avatar

Send message
Joined: 27 May 07
Posts: 3720
Credit: 9,385,827
RAC: 0
Bulgaria
Message 1276681 - Posted: 28 Aug 2012, 14:07:26 UTC - in response to Message 1276677.  

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.

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!" :)
 
ID: 1276681 · Report as offensive
Profile janneseti
Avatar

Send message
Joined: 14 Oct 09
Posts: 14106
Credit: 655,366
RAC: 0
Sweden
Message 1276677 - Posted: 28 Aug 2012, 13:42:08 UTC - in response to Message 1276574.  

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.
ID: 1276677 · Report as offensive
Profile BilBg
Volunteer tester
Avatar

Send message
Joined: 27 May 07
Posts: 3720
Credit: 9,385,827
RAC: 0
Bulgaria
Message 1276671 - Posted: 28 Aug 2012, 13:09:37 UTC - in response to Message 1276381.  
Last modified: 28 Aug 2012, 13:34:31 UTC

Well, there is shutdown.exe, but I don't know how you might trigger it based on Boinc doing work or not.

With this batch file:
@echo off
goto check_folders
:boinc_running
echo %date% %time% BOINC running.
sleep 300
:check_folders
if exist "C:\ProgramData\BOINC\slots\0\boinc_lockfile" goto boinc_running
if exist "C:\ProgramData\BOINC\slots\1\boinc_lockfile" goto boinc_running
if exist "C:\ProgramData\BOINC\slots\2\boinc_lockfile" goto boinc_running
if exist "C:\ProgramData\BOINC\slots\3\boinc_lockfile" goto boinc_running
echo %date% %time% boinc_lockfile not found, waiting 60 seconds...
sleep 60
if exist "C:\ProgramData\BOINC\slots\0\boinc_lockfile" goto boinc_running
if exist "C:\ProgramData\BOINC\slots\1\boinc_lockfile" goto boinc_running
if exist "C:\ProgramData\BOINC\slots\2\boinc_lockfile" goto boinc_running
if exist "C:\ProgramData\BOINC\slots\3\boinc_lockfile" goto boinc_running
echo %date% %time% boinc_lockfile not found, waiting 60 seconds again...
sleep 60
if exist "C:\ProgramData\BOINC\slots\0\boinc_lockfile" goto boinc_running
if exist "C:\ProgramData\BOINC\slots\1\boinc_lockfile" goto boinc_running
if exist "C:\ProgramData\BOINC\slots\2\boinc_lockfile" goto boinc_running
if exist "C:\ProgramData\BOINC\slots\3\boinc_lockfile" goto boinc_running
echo %date% %time% No active WUs, shuting down.>>autoshutdown.txt
shutdown -s -t 1

This one is for standard installation of BOINC on Windows 7. The sleep.exe is part of the Windows Server 2003 Resource Kit Tools, extract that somewhere and copy sleep.exe to the Windows directory.

If you have many devices, it might me good to increase the number of slots checked, this one I used on a single core machine without a GPU.

It will create a autoshutdown.txt file in the directory where it is run from, where you will see, when the machine has shutdown, if you don't need/want it, remove the corresponding line.


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!" :)
 
ID: 1276671 · Report as offensive
Profile Link
Avatar

Send message
Joined: 18 Sep 03
Posts: 833
Credit: 1,807,369
RAC: 1
Germany
Message 1276574 - Posted: 28 Aug 2012, 7:23:52 UTC - in response to Message 1276545.  
Last modified: 28 Aug 2012, 7:39:53 UTC

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.
ID: 1276574 · Report as offensive
rob smith Crowdfunding Project Donor*Special Project $75 donorSpecial Project $250 donor
Volunteer moderator
Volunteer tester

Send message
Joined: 7 Mar 03
Posts: 18644
Credit: 416,307,556
RAC: 863
United Kingdom
Message 1276545 - Posted: 28 Aug 2012, 5:27:39 UTC

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?
ID: 1276545 · Report as offensive
Profile Link
Avatar

Send message
Joined: 18 Sep 03
Posts: 833
Credit: 1,807,369
RAC: 1
Germany
Message 1276427 - Posted: 27 Aug 2012, 20:37:14 UTC - in response to Message 1276389.  
Last modified: 27 Aug 2012, 20:42:40 UTC

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.
ID: 1276427 · Report as offensive
Previous · 1 · 2 · 3 · Next

Message boards : Number crunching : Shutting down pc


 
©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.