leestevetk / WoL.sh

WoL.sh - a simple Wake-on-LAN shell script
https://leesteve.tk/WoL.sh
MIT License
40 stars 15 forks source link

Netcat referenced by "nc" alias, and script hangs after sending WOL packet #1

Open ChristopherW opened 2 years ago

ChristopherW commented 2 years ago

On my system, an x86 DSM (Linux-based) Synology NAS, running the script results in an error:

Sending magic packet.../volume1/homes/wol/wol.sh: line 68: nc: command not found

I installed netcat using Entware, and confirmed the binary was in a folder included in PATH, however the nc alias was not created. I did so with alias nc=netcat but the script was still unable to invoke nc.

To resolve this I amended the script to explicitly reference the netcat binary.

After doing this, I received a different issue - sending a packet worked, but in what appears to be this bug related to netcat hanging indefinitely in UDP mode, The prompt showed Sending magic packet... until I sent SIGINT, at which point it showed the success message and exited. The suggested -w0 command doesn't work on this flavour of netcat ("GNU netcat 0.7.1").

To resolve this issue, I amended the script to use -cu instead of -w1 and now the script exits correctly upon completion.

wei-z-git commented 6 months ago

I have the similar issue with my Android termux, I fix this by reinstalling the netcat