2
2
I'm looking for a way (programmatically or otherwise) to determine if my machine was woken up by WOL or not (let's say, a Ubuntu Server box).
This is sort of a two-fold question, where I want to know if I can:
a) Hook something that'll hear about being woken up when the machine comes out of sleep and
b) Can then determine somehow whether the wake was due to WOL or not
I'm not too concerned by what mechanism (if any) this is achieved, but am interested really in whether it's even possible.
Maybe if there was some file that logged wake up/sleep times, I could write a small program that looped and occasionally checked the file for changes, but don't know what i'd need to do to figure out of it was WOL or not (or if such a file exists).
Thanks
How about physical switches – is there any loggable event on those? (In my case, I care about discerning WOL vs physical switch for returning from suspend – in the WOL case, and only then, I want to run a script and then suspend.) – unhammer – 2018-04-26T12:36:55.370
What is your use case? What other events cause your computer to wake? – depquid – 2013-04-20T15:11:25.940
1@depquid imagine a scenario where someone physically might wake the machine up, in which case you want to let them proceed, but someone on the network might wake the machine up, in which case you want to follow certain procedures to verify the intent of the wake up, and on failure of that sleep the machine again. – Rhys – 2013-04-20T15:39:15.157
I'm not sure what you mean by "intent". The implied intent of a WOL packet is to wake the computer up. Or is this a security issue where you are concerned about other users of the network issuing WOLs to your computer? Perhaps you could wait 5 minutes after boot for a user to log in, locally or remotely, and then sleep again if no one does. – depquid – 2013-04-20T15:44:33.027
If I'm not mistaken, WOL is provided by the BIOS. So unless the BIOS exposes something on how the PC was powered up, I don't think you can get that information. – Bobby – 2013-04-20T19:14:18.140