Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
What is your use case? What other events cause your computer to wake? –  depquid Apr 20 '13 at 15:11
    
@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. –  Ryven Apr 20 '13 at 15:39
    
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 Apr 20 '13 at 15:44
    
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 Apr 20 '13 at 19:14
add comment

2 Answers

To determine if your machine has woken up, you can test if you can reach it, as you would with any other machine to see if it's there:

  • ping
  • telnet some port of a service bound to the startup of of the machine
  • use snmp if configured

As whether you can be able to know if your machine has been started by WOL or not, that is not possible, as all the communication between the elements involved in WOL. that is, the magic packet, the ethernet card and the BIOS, occurs before the operating system is even booted.

share|improve this answer
add comment

You would need another always on device to constantly monitor the wire for the WOL packet. Such a device would have to be relatively smart. Another computer running a tool in promiscuous mode setup to search for the WOL packet should in theory be able to catch it.

The device would have to be always on and scanning the network connection. There is a possibility the sensor could miss it, but it should work. In short, basically another PC. While there might be some network device out there that could do I don't know about it. I have never used one, but there exists at least the possibility that a switch loaded with a linux firmware might be able to do it.

linux router/switch firmware product device support page

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.