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?