Comprehensive data protection for all workloads
Post Reply
Zek
Service Provider
Posts: 22
Liked: 12 times
Joined: Mar 29, 2019 3:32 am
Contact:

B&R server doesn't prevent OS from entering to sleep

Post by Zek »

Hello,

B&R server and components doesn't prevent itself from entering to sleep when job is in active states, unlike the Backup agent for windows.
Dear developers, can you use SetThreadExecutionState WinAPI function (https://learn.microsoft.com/en-us/windo ... utionstate) for active B&R jobs, what required to inform Windows OS about active applications state?
Support case #06139175.
For example, if there is Veeam Agent active job exist for server and repository hosts, they still going to sleep state when power settings plan sleep timeout expired.
HannesK
Product Manager
Posts: 14322
Liked: 2890 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: B&R server doesn't prevent OS from entering to sleep

Post by HannesK » 1 person likes this post

Hello,
on one hand, it sounds like a useful idea. On the other hand, this seems to be the first request after more than 15 years and I ask myself, what's the idea of having automatic sleep enabled on infrastructure machines?

How would they power-on automatically? Do you have pre-scripts for that?

Best regards,
Hannes
Zek
Service Provider
Posts: 22
Liked: 12 times
Joined: Mar 29, 2019 3:32 am
Contact:

Re: B&R server doesn't prevent OS from entering to sleep

Post by Zek »

How would they power-on automatically? Do you have pre-scripts for that?
You dont need to have script with legacy magic packet, network cards have been supporting wake on demand from traditional sleep state (ACPI S3) for over 10 years, this is naming wake on pattern match. Also, while B&R support client OS (win10 and win11) for installation, this can be also useful for modern standby feature, but I have no much experience and cannot say anything about this, but I think there will also be a problem currently with falling asleep.
BackupBytesTim
Service Provider
Posts: 398
Liked: 57 times
Joined: Apr 29, 2022 2:41 pm
Full Name: Tim
Contact:

Re: B&R server doesn't prevent OS from entering to sleep

Post by BackupBytesTim »

I'll add that nearly every computer these days also has UEFI (or BIOS) options for waking on a schedule as well, which would also solve the "sleeping infrastructure" problem.
HannesK
Product Manager
Posts: 14322
Liked: 2890 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: B&R server doesn't prevent OS from entering to sleep

Post by HannesK » 1 person likes this post

yes, I used wake on LAN many years ago. Wake-up timers would not help, if I want to restore something while the repository is down.

I'm just surprised, that customers really shut down their infrastructure machines (obviously not many, because otherwise there were more requests for it). I remember VMware also has that feature to shut down ESXi hosts if they are not used, but the customers I know who used it stopped using it.

Maybe IT really starts to become greener :-)
Zek
Service Provider
Posts: 22
Liked: 12 times
Joined: Mar 29, 2019 3:32 am
Contact:

Re: B&R server doesn't prevent OS from entering to sleep

Post by Zek »

Here is simple workaround PS script which prevent sleep while active agent backup jobs exist:

Code: Select all

$code=@' 
[DllImport("kernel32.dll", CharSet = CharSet.Auto,SetLastError = true)]
public static extern void SetThreadExecutionState(uint esFlags);
'@

$ste = Add-Type -memberDefinition $code -name System -namespace Win32 -passThru 
$ES_CONTINUOUS = [uint32]"0x80000000"
$setting = $ES_SYSTEM_REQUIRED


    
while ($true) {
    Write-Verbose "Check Veeam active job"
    $ActiveJobs = Get-VBREPJob | where {$_.LastState -eq "Working"}
    
    If ($ActiveJobs) {
        Write-Verbose "Active job found"

        Write-Verbose "Power Plan suspended with option: $option"

        $ste::SetThreadExecutionState($ES_CONTINUOUS -bor $setting)        
    } else {
        Write-Verbose "Active job not found"
        Write-Verbose "Power Plan suspension ended"
        $ste::SetThreadExecutionState($ES_CONTINUOUS)
    }

    Start-Sleep -Seconds 60

}
ftravinsky
Influencer
Posts: 18
Liked: 5 times
Joined: Feb 03, 2020 10:38 am
Full Name: Fedor Travinsky
Location: Moscow
Contact:

Re: B&R server doesn't prevent OS from entering to sleep

Post by ftravinsky » 1 person likes this post

As untraditional it seems, I concur with the standby failsafe, it won’t hurt.
Even torrent clients have this “prevent standby” option, while they do their job.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 129 guests