SR-G / sleep-on-lan

Multi-platform process allowing to sleep on LAN a linux or windows computer, through wake-on-lan (reversed) magic packets or through HTTP REST requests.
Apache License 2.0
332 stars 25 forks source link

4 command executions for 1 sent UDP packet ? #16

Closed girque closed 6 years ago

girque commented 6 years ago

Hi, First of all thank you for this projet, it's very useful.

When I send 1 "UDP SoL packet" (with Mocha VNC Lite on iPhone), it results (after the log info) with 4 executions of the shutdown command in my case. The server shutdowns correctly but there is a quite annoying issue. If I try to restart the computer immediately (WoL packet), it's shut down again after several seconds. My guess is the others UDP SoL packets were stuck in some buffer and once the network card is up it is turned off again. Is that possible? Could it be that I ran the service 4 times and badly killed it? (even after rebooting.. I don't think so)

Log errors are just a user permission issue. This log is the result of 1 UDP SoL packet, is it normal it executes 4 times ?

capture d ecran 2017-12-20 a 11 27 40

Some features you could add: -A REST "login page" to secure the Sleep on Wan -A REST page to know the machine state (on/off)

girque commented 6 years ago

Maybe the user permission issue was the source of the problem after all:

SR-G commented 6 years ago

Ok hadn't time to investigate your main issue (which i've never encountered on my side), glad you solved it by yourself.

For non-root execution, i was suggesting the setcap method in the global README.md (https://github.com/SR-G/sleep-on-lan), but other methods may of course work.

For your additional comments :

girque commented 6 years ago

Yes I followed the setcap technique to listen on port 9. But still permissions to write in /var/log/sleep-on-lan.log and also use shutdown command are needed. As you said there are many methods..

SR-G commented 6 years ago

Ok, would #18 do the trick, could you review it ? (already coded, awaiting to see if it would meet your needs)

Would allow :

Questionning another server through MAC addresses rather than IP would be possible but a little bit more complicated (would need to know which network interface to use in order to make the ARP query on).

girque commented 6 years ago

Yes it is perfect like this. We can get the status of other computers in the local network. No need for more NAT/PAT or SSH... to ping them, quite useful and simple. I suggest you update the doc accordingly when released ;) Cheers !