Send server to sleep with other computer help
#31
When tested your scripts the power management is off so it will do nothing well I think it will do nothing have not tried that to see what happens at the 20min mark but I might try it.

I was not running your scripts when I was transferring files to the server. but I did leave the server on without accessing it for 20 min when i did this and noticed it turned off when I had the sleep option turned on in the power management set to 15 min.

I am going to use your scripts instead as I like the idea of the server turning off after 1 min of the htpc been turned off.

.
Reply
#32
You can use the Win7 tool powercfg.exe to handle global powermanagement.
Open a cmd running as admin and type

Code:
powercfg -A

This gives you a list of all powerstates your system is capable of, also whether hibernation is activated at all.
If it is, you can turn it off globally (and getting rid of the hidden hibernation file) with

Code:
powercfg -H OFF

Executing

Code:
powercfg -X -standby-timeout-ac 0

and

Code:
powercfg -X -standby-timeout-dc 0

makes sure that your active powerscheme also will never activate standby.
Bye,
Fry
Kodi v17.6 with shared MariaDB v10.3 | HTS Tvheadend 4.2.6 on RPi2 | running on:
Windows 10x64 | Nvidia Shield | FireTV4k | FireTVStick4 | Android 5 | RPi3 with OSMC
Reply
#33
thanks for the help

will try it out just about getting there
Reply
#34
HI mate just a quick question which is better to use

powercfg -h off
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
powercfg -h on

or

the tool called psshutdown with a command line of

psshutdown -d

as i have decided to sleep the server instead of hibernate as it takes way to much time to boot.

I have herd that using

powercfg -h off
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
powercfg -h on

can damage the files on the computer as your not supposed to use this method as the .dll files where never designed to do this ? is this true

cheers
Reply
#35
Hey...

If you execute 'powercfg -h off' once with elevated rights, your system will deactivate hibernation (suspend-to-disk) globally.

So the call of 'rundll32.exe powrprof.dll,SetSuspendState Standby' will force the server/pc to suspend-to-ram (if it's capable of) - way faster in waking up, but a little more power consumption then (nevertheless: I'm walking that route for years).

You could also use psshutdown, but what it does is exactly the same: calling the designated Windows function, so no real reason for going for this instead of onboard executables.

As far as my experiences reach: since XP SP3 you won't need to worry about standby or hibernate causing any problems, with Win 7 you are definitely safe!
What may cause problems is the additional hardware you've installed (does the driver handle standby or hibernation properly, things like TV cards often don't work after standby), but your OS itself won't be caused any harm.
Ok: being in standby and having a power loss: unpredictable...
Being in hibernation and having a power loss: no problem.
So, if you want to be 100% sure that your server survives a possible power loss while being in standby: buy a well sized UPS (Uninterruptible Power Supply).



Bye,
Fry
Kodi v17.6 with shared MariaDB v10.3 | HTS Tvheadend 4.2.6 on RPi2 | running on:
Windows 10x64 | Nvidia Shield | FireTV4k | FireTVStick4 | Android 5 | RPi3 with OSMC
Reply
#36
Thanks the server is a ivybridge system with the latest hardware and I have tried the sleep and works. Does not really matter if I have a power cut here and there as the server can just be restarted.

Was not to sure if it would be safe to use the rundll32.exe powrprof.dll,SetSuspendState 0,1,0 as i was not to sure.

So you use sleep instead of hibernation as well

So would u use

rundll32.exe powrprof.dll,SetSuspendState 0,1,0
Or
rundll32.exe powrprof.dll,SetSuspendState standby

Not to sure what the difference is. i have also removed the powercfg -h off as I did this in the command window, like you say it only needs to run once and keeps this setting even when powered off.

I also read that rundll32.exe powrprof.dll,SetSuspendState 0,1,0 does not support task scheduler but psshutdown does, was not to sure why if it does the same thing.

Thanks
Reply
#37
(2013-01-23, 22:02)meridius Wrote: Does not really matter if I have a power cut here and there as the server can just be restarted.

Well, THIS MIGHT raise issues: if your server is in standby and you have a power loss, the chance of loosing data that was not written to the hdd BEFORE entering standby is quite high...

(2013-01-23, 22:02)meridius Wrote: So would u use

rundll32.exe powrprof.dll,SetSuspendState 0,1,0
Or
rundll32.exe powrprof.dll,SetSuspendState standby

Not to sure what the difference is.

Win 7 knows of three powersaving states: standby, hibernation and hybrid. Hybrid is a mixture of standby and hibernation, and - if it does anyway - it really only makes sense on mobile computers.
So: deactivate hybrid manually (don't know of a command line to do that) at first.
After you deactivated hibernation on your system, too (the hibernation file on your system's drive will be deleted after that), the command 'rundll32.exe powrprof.dll,SetSuspendState Standby' will force your computer to enter standby (S3).
If hibernation would still be possible, that command would cause hibernation instead of standby...

(2013-01-23, 22:02)meridius Wrote: I also read that rundll32.exe powrprof.dll,SetSuspendState 0,1,0 does not support task scheduler but psshutdown does (...)

If you call the rundll32 function inside the script I shared, it will definitely be executed, even if the whole thing was started by the scheduler - as mentioned, works for me for years now (productive on Win7 and WinServer 2008R2).
But: you won't be able to call the dll's function directly from the scheduler. That's why it's called by the script Wink
Bye,
Fry
Kodi v17.6 with shared MariaDB v10.3 | HTS Tvheadend 4.2.6 on RPi2 | running on:
Windows 10x64 | Nvidia Shield | FireTV4k | FireTVStick4 | Android 5 | RPi3 with OSMC
Reply
#38
Cheers
this is the post I read about not using rundll32 to put the computer to sleep

http://superuser.com/questions/331542/sl...545#331545

Just thought I would share that that's why I asked this question

My server does not run anything just windows no apps nothing so when going to sleep and having a power cut should not do anything.

I will use powercfg -h off to disable hibernation so that the computer will use sleep instead.

Will I use

rundll32.exe powrprof.dll,SetSuspendState 0,1,0
Or
rundll32.exe powrprof.dll,SetSuspendState standby

Not to sure or does it not matter in the shutdown script.

Chees


Reply
#39
Yeah, googled a bit, and you're right: the switch 'standby' is NOT needed (rubbish after all, sorry for that) if you've already turned off hibernation (and hybrid), it will only trigger the best (or only one in this case) available power saving state, so 'rundll32.exe powrprof.dll,SetSuspendState' would suffice in that case to trigger S3.

If hibernation is still active, calling 'rundll32.exe powrprof.dll,SetSuspendState false, true, true' would enter S3, 'rundll32.exe powrprof.dll,SetSuspendState true, true, true' would hibernate.

Anyway, if you've disabled hibernation, you'll enter S3 by calling 'rundll32.exe powrprof.dll,SetSuspendState'. Any switches after that command would be ignored by Windows. So: my script would work either way.

Concerning your first link: that's about coding Windows programs using API calls - but we are not programming, we just USE those existing API calls...
Bye,
Fry
Kodi v17.6 with shared MariaDB v10.3 | HTS Tvheadend 4.2.6 on RPi2 | running on:
Windows 10x64 | Nvidia Shield | FireTV4k | FireTVStick4 | Android 5 | RPi3 with OSMC
Reply
#40
Thanks

I read that if you use powercfg -h off it disables both hibernation and hyber sleep but leaves sleep

NOTE: This step will disable hibernation, delete the hiberfil.sys file, and remove the Allow hybrid sleep and Hibernate after Power Options under Sleep. This will also disable fast startup in Windows 8.

http://www.sevenforums.com/tutorials/819...sable.html

Sleep saves any open documents and programs to memory only, and then puts the computer into a low-power state. If you lose power to the computer, you will also lose what is in memory.

The problem is the sleep of windows or xbmc on my htpc has the hybrid sleep option on

Hybrid sleep saves your open documents and programs to memory and to the hard drive, and then puts the computer into a low-power state. After the Hibernate after time you set, it will then put the computer into hibernation. This requires that hibernate is enabled.

On the server using the powercfg off it disables hyber sleep and leaves sleep would this matter on a server ? As it would just save to memory and not memory and hardrive like hyber sleep does.

Do you use hibernation, hyber sleep or sleep.

Cheers




Reply
#41
I'm using only sleep and am aware of problems that may arise if there would be a power loss.
But as to the power loss: I'm ready do live with that because there wasn't a power loss in my home for 3 years now...
If I'd felt too anxious about it, I'd buy - as mentioned above - an UPS Wink
Bye,
Fry
Kodi v17.6 with shared MariaDB v10.3 | HTS Tvheadend 4.2.6 on RPi2 | running on:
Windows 10x64 | Nvidia Shield | FireTV4k | FireTVStick4 | Android 5 | RPi3 with OSMC
Reply

Logout Mark Read Team Forum Stats Members Help
Send server to sleep with other computer help0