OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • CRON entry for WOL
« previous next »
  • Print
Pages: [1]

Author Topic: CRON entry for WOL  (Read 5052 times)

jstrebel

  • Full Member
  • ***
  • Posts: 188
  • Karma: 23
    • View Profile
CRON entry for WOL
« on: August 10, 2020, 12:03:21 pm »
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
Logged

marjohn56

  • Hero Member
  • *****
  • Posts: 1701
  • Karma: 179
    • View Profile
Re: CRON entry for WOL
« Reply #1 on: August 23, 2020, 11:34:04 am »
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.
« Last Edit: August 23, 2020, 11:37:12 am by marjohn56 »
Logged
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member - If we've helped you remember to applaud

tmbopn

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: CRON entry for WOL
« Reply #2 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.

Hint: don't use a hyphen "-" in the description, it won't let you safe the cron job.
« Last Edit: August 30, 2020, 11:50:46 am by tmbopn »
Logged

marjohn56

  • Hero Member
  • *****
  • Posts: 1701
  • Karma: 179
    • View Profile
Re: CRON entry for WOL
« Reply #3 on: August 30, 2020, 11:14:14 pm »
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.
Logged
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member - If we've helped you remember to applaud

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • CRON entry for WOL
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2