1

I have a small script (on WSL / Debian) to rsync my files to my Debian server.
I've set the script to run every two hours.

My laptop is a Windows 10 machine.

When put to sleep / idle, the laptop goes into a Modern Standby state:

When Modern Standby-capable systems enter sleep, the system is still in S0 (a fully running state, ready and able to do work).

This is different from the old S3 state which is where the machine truly was on idle:

Windows and the SoC hardware are always listening for interesting events (such as a network packet or user input at a keyboard) and will wake up instantly when needed. The system will wake when there is real time action required, such as for OS maintenance or when a user wakes the system

This means that even when I put my laptop to sleep, it's still running the cron job every two hours, which is unnecessary.

Is there any way that WSL can retrieve the power state, e.g. through powercfg so that it only runs the script when the computer is awake?

TylerH
  • 20,799
  • 66
  • 75
  • 101
NoExpert
  • 376
  • 1
  • 2
  • 11
  • There doesn't seem to a be anything in the winapi docs under [power management functions](https://learn.microsoft.com/en-us/windows/win32/power/power-management-functions) that lets you see if you're in s0-low-power vs s0. There might not be a way to do this. – imbuedHope Aug 15 '22 at 02:25

0 Answers0