Hi, would somebody help me to create a entry which sends a WOL packet via Cron to a device on my LAN.
Probably I just need to know where the WOL???.php ist located. Then I could call it trough Cron, would this work?
Thank you Jakob
There is no wol??.php per say, there is a plugin os-wol, but that does not support cron events. However, it's pretty easy to either make a couple of simple changes, or roll your own.
Here I'll use the plugin and make a change to a file that will allow us to use its functions to do what you want. First install the plugin os-wol.
Next we need to make a change to the plugin's actions.conf to make it visible for cron. Find the file actions_wol.conf, it will be in /usr/local/opnsense/service/conf/actions.d/
Add a line after the type:script so it looks like this:
[wake]
command:/usr/local/bin/wol -i
parameters: %s %s
type:script
description:Wake-on-LAN
Save it. Now go to shell and issue the command
# service configd restart
That's it, we're ready to create the cron event.
Goto system->settings->cron and fill in the time, days etc etc. Then the command dropdown box should list the Wake-On-LAN command for you to select.
Finally the parameters, the first parameter is the net you want to send the WOL on, so you'll need the broadcast address of the subnet you want, i.e. If the LAN is 192.168.1.0/24 then enter the address 192.168.1.255. The second parameter is the MAC address of the device you want to wake: i.e 11:22:33:44:55:66, so the parameters box should contain something like this:
192.168.1.255 11:22:33:44:55:66
Save it and that should work.
Thanks for the guidance, it is excactley what I was looking for. Wondering why this is not standard in opnsense.
Hint: don't use a hyphen "-" in the description, it won't let you safe the cron job.
Quote from: tmbopn on August 30, 2020, 11:46:54 AM
Thanks for the guidance, it is excactley what I was looking for. Wondering why this is not standard in opnsense.
Because the building blocks are there for you to do it for yourself.