Cron for WOL
I find an old topic here but comand do not work. Please could someone update the right command?
What do you mean ?
[2.3.4-RELEASE][firstname.lastname@example.org]/root: wol wol: Too few arguments. Try `wol --help' for more information. [2.3.4-RELEASE][email@example.com]/root: wol --help Usage: wol [OPTION] ... MAC-ADDRESS ... Wake On LAN client - wakes up magic packet compliant machines. --help display this help and exit -V, --version output version information and exit -v, --verbose verbose output -w, --wait=NUM wait NUM millisecs after sending -h, --host=HOST broadcast to this IP address or hostname -i, --ipaddr=HOST same as --host -p, --port=NUM broadcast to this UDP port -f, --file=FILE read addresses from file FILE ("-" reads from stdin) --passwd[=PASS] send SecureON password PASS (if no PASS is given, you will be prompted for the password) Each MAC-ADDRESS is written as x:x:x:x:x:x, where x is a hexadecimal number between 0 and ff which represents one byte of the address, which is in network byte order (big endian). PASS is written as x-x-x-x-x-x, where x is a hexadecimal number between 0 and ff which represents one byte of the password. Report bugs to <firstname.lastname@example.org></email@example.com>
The command works ….
The cron package exists also now.
I just woke up our coffee machine.....
I have this.. (see pict). Normally it should wake my NAS everyday at 10.01.
It never wake it… :(
PS : My NAS wakes up if I do WOL manually.
Putting the command in a cron is the final step.
You tested the command from the console (SSH !) interface ?
You did set up the NAS so it wakes up on when it receives the WOL packet ?
Try also to wake it up from a windows PC using : https://sourceforge.net/projects/aquilawol/
And even : try to wake up a Windows PC (settings have to be made in Windows and may be even the BIOS).
When you can WOL "by hand" only then you automise (by cron).
Check if the cron line is executed (see logs).
Yes I know what mean WOL ! LOL! ;D ;D ;D
Years I do manually (by hand..).
In Pfsense there is ALSO a function for WOL and "by hand" it works perfectly with my NAS.
Thats why I am confused…
Any update on this old topic? I am in the same boat as OP.
I can manually start my unraid server and test Dell laptop from the WOL menu under Services but when I try to schedule the cron job or run the command manually I do not get the WOL protocol.
I am monitoring the network traffic from Wireshark and I can see a protocol "WOL" when I run the wake up from the Services menu. When I try to run this command from cron or manually under Diagnostics> command prompt I only see TCP protocols broadcast.
I am trying to wake both Unraid and Dell laptop.
here is the commands I have been trying
/usr/local/bin/wol (Mac address) This will broadcast to entire IP scheme
/usr/local/bin/wol -v -i 172.x.x.x (Mac address) This only targets the exact IP of the machine
Any help would be great
I just power down a PC next to me, and the I typed in
/usr/local/bin/wol -v -i 192.168.1.7 b8:ac:6f:47:2d:b2
The PC woke up immediately.
Btw : I use the console access. That the one for 'real' commands.
It's usually because the user Cron runs with is not admin/root and somethings are subtly different. Default paths, permissions etc. You are using the complete path so that rules that out. Do you see any errors logged at that time?
I know what you and OP mean. I have the same issue. It works manually but not via cron.
I want to wake up my server at 7 am but it won' t work. So after I realized it was not working I punshed the command in the command line and I got one error. It says that the host was not reachable. But direct after that I used the WOL service of the pfsense and it worked perfectly. (I am using pfSense 2.4.4. p3)
So was is the weird behaviour?
I've discovered a solution for this problem. Here you can find it. It' s a german post. Translated it says:
You have to activate the "static ARP" option at the "DHCP Static Mappings for this Interface" of the DHCP Server. Now you can wake your Host up with (direct from shell or via cron):
/usr/local/bin/wol -i IP MAC
Hmm, that should not be required. The machine doing the waking should not need to know anything but the MAC address.
Does it just not send the packet if you use the MAC only?
Sorry, I don't know. I didn' t used the wol command without the IP option.
I bumped into the same problem. Sharing my findings for future visitors (tested with VLANs present - not sure if it matters).
Specifying the interface is optional, but without it the command doesn't work.
wol xx:xx:xx:xx:xx:xx- executes, but no magic packet to device.
wol -i 192.168.1.255 xx:xx:xx:xx:xx:xx- works.
- Manually add job definition to
/etc/crontab- works, job triggers.
crontab -e(as root user) - reports success, but job doesn't trigger. I also tried restarting cron after adding entries as another post suggested, but no luck.
/etc/crontabfile directly and add your entry there. For the interface address, either machine IP or broadcast IP may be specified.
... # Wake up server at 6:30 30 6 * * * root wol -i 192.168.1.255 c0:3f:d5:66:XX:XX ... # # If possible do not add items to this file manually.
So, edit /etc/crontab file directly
pfSense most simple package might be useful here.
Introducing the wol package :
Now, your own crons will even be saved in the global pfSense config, making it a real set it and forget it thing.
Also, according to the "official manual" :
If FreeBSD was installed on desktop type device with a single NIC, then this option is an option as there is only one NIC.
Our pfSense tends to have at least 2 NICs. So the option is qualified as "important".
I guess it's even a security issue if wol starts to send its notifications on all my xx interfaces.
Also had no luck getting wol with cron to work, the command is not even working in the GUI command prompt...
/usr/local/bin/wol -v -i 192.168.1.21 dx:50:99:92:11:e7
But working flawlessly via the pfSense >Services>Wake-on-LAN
I ping 192.168.1.2 : it's powered down.
I "wol" it.
It ping again and it replies ....
[2.5.2-RELEASE][firstname.lastname@example.org]/root: wol wol: Too few arguments. Try `wol --help' for more information. [2.5.2-RELEASE][email@example.com]/root: ping 192.168.1.2 PING 192.168.1.2 (192.168.1.2): 56 data bytes ^C --- 192.168.1.2 ping statistics --- 3 packets transmitted, 0 packets received, 100.0% packet loss [2.5.2-RELEASE][firstname.lastname@example.org]/root: wol -v -i 192.168.1.2 00:4e:01:ac:ca:9c Waking up 00:4e:01:ac:ca:9c with 192.168.1.2:40000... [2.5.2-RELEASE][email@example.com]/root: ping 192.168.1.2 PING 192.168.1.2 (192.168.1.2): 56 data bytes 64 bytes from 192.168.1.2: icmp_seq=2 ttl=128 time=0.255 ms 64 bytes from 192.168.1.2: icmp_seq=3 ttl=128 time=0.325 ms 64 bytes from 192.168.1.2: icmp_seq=4 ttl=128 time=0.333 ms 64 bytes from 192.168.1.2: icmp_seq=5 ttl=128 time=0.291 ms ^C --- 192.168.1.2 ping statistics --- 6 packets transmitted, 4 packets received, 33.3% packet loss round-trip min/avg/max/stddev = 0.255/0.301/0.333/0.031 ms
In the past, when wol was still a magic (pun intended) thing, there was a tool that you could run on the device to be waken up : it showes you that it's NIC did receive the magic wake up packets.
These packets are used to wake up the device, if it is able to do so, and if it was allowed to do (by driver and or BIOS settings).
@gertjan One difference might be that my NIC doesn't have an IP address, its only purpose it to wake up the PC.
And again, it is working flawlessly via the GUI Services>Wake-on-LAN
And again, it is working flawlessly via the GUI Services>Wake-on-LAN
GUI Services>Wake-on-LAN ?
Aha, you mean https://pfsense.yourlocal.tld/services_wol.php.
You had a look how "services_wol.php" does it's wol thing ?
( it used the wol command like you ;) )
'wol' needs an IP ( ?) so it can determine the interface to be used..
The interface has an IP, right ?
When I used a fake IP, like 192.168.1.200 instead of 192.168.2, my "00:4e:01:ac:ca:9c" device didn't wake up.
What happens if you use the pfSense interface IP there? In the same segment as the target?
@stephenw10 Doesn't work either and yes.
If I try with putty I get this.
[2.5.2-RELEASE][admin@pfSense.home.arpa]/root: /usr/local/bin/wol -v -i 192.168.1.1 d0:50:99:92:11:e7 Waking up d0:50:99:92:11:e7 with 192.168.1.1:40000... [2.5.2-RELEASE][admin@pfSense.home.arpa]/root: /usr/local/bin/wol -v d0:50:99:92:11:e7 /usr/local/bin/wol: Cannot send magic packet for 'd0:50:99:92:11:e7' to 255.255.255.255:40000: Permission denied [2.5.2-RELEASE][admin@pfSense.home.arpa]/root: /usr/local/bin/wol d0:50:99:92:11:e7 /usr/local/bin/wol: Cannot send magic packet for 'd0:50:99:92:11:e7' to 255.255.255.255:40000: Permission denied [2.5.2-RELEASE][admin@pfSense.home.arpa]/root:
But again, none of this worked.
If your "device without IP" (
serious ??see below ) is some windows device, try this :
I had to indicate a port number like "40000" on both side so the command line works :
wol -i 192.168.1.2 00:4e:01:ac:ca:9c -p 4000 Waking up 00:4e:01:ac:ca:9c...
The tool on the device, my PC, that it received the special pachet (5 times the device MAC as the data payload)
See also the FreeBSD mn page for wol https://www.freebsd.org/cgi/man.cgi?query=wol&manpath=ports&sektion=1
edit : a device in lower power mode doesn't have - use an IP(v4 or v6).
It just listens to the incoming data stream, and knows how to detect if it's won MAC is present 5 times in a row. No processor power is needed.
wol needs a IP or host just to so it can find out on what interface to use if it is "multi homed", like our pfSense. The actual IP shouldn't matter ......
I think that our switches play an important role here. Switches are not hubs, so traffic isn't broadcasted any more.
When I use the broadcast IP of my LAN, like :
wol -i 192.168.1.255 -p 4000 00:4e:01:ac:ca:9c
it worked, the Wake On Lan monitor on my PC showed the incoming magic packet.
@gertjan I want to use wol (not pattern match?) for this. I ended up using wol.exe on another Windows host together with windows tasksheduler to achieve what pfSense couldn't do for me.
@bob-dig I edited - see above.
@gertjan So this time I tried in putty:
/usr/local/bin/wol -v -i 192.168.1.255 d0:50:99:92:11:e7
And it did work. Then I tried cron, also does work!
So the key is to use .255 at the end.
I still wonder why the web-GUI-thingy works with the MAC only, but on the other hand, when I first added the host to the Wake-on-LAN Devices list, it had an IP-address, so it might have saved it there.
Thank you @Gertjan !!