What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

scripted WOL?

gneville

New Around Here
Is it possible to script WOL of a device on my network with the Merlin firmware?

I saw a script that does something cleverer than this but all I want is the WOL function, thanks!
 
Yes, it should be fairly straight forward. Use the ether-wake command in your script.
Code:
# ether-wake
BusyBox v1.20.2 (2015-03-23 22:34:23 MST) multi-call binary.

Usage: ether-wake [-b] [-i iface] [-p aa:bb:cc:dd[:ee:ff]] MAC

Send a magic packet to wake up sleeping machines.
MAC must be a station address (00:11:22:33:44:55) or
a hostname with a known 'ethers' entry.

        -b              Send wake-up packet to the broadcast address
        -i iface        Interface to use (default eth0)
        -p pass         Append four or six byte password PW to the packet
 
Hi Colin,

Thanks for the reply, looks just the thing!

So I guess I write my ether-wake command , and save it in /jffs/scripts/ - but I'm not sure how I would schedule this script to run once a day, for example.. can you give me any pointers?

Thanks!
 
Just use "cru" to schedule a cron job.
Code:
# cru

Cron Utility
add:    cru a <unique id> <"min hour day month week command">
delete: cru d <unique id>
list:   cru l
For example to run a script at 23:00 every day:
Code:
# cru a MyWOL "00 23 * * * /jffs/scripts/MyWOL.sh"
# cru l
00 23 * * * /jffs/scripts/MyWOL.sh #MyWOL#
Of course, if you reboot your router the cron entry will be lost so you probably want to put your cru command in a "services-start" script so that it runs at boot time.

https://github.com/RMerl/asuswrt-merlin/wiki/User-scripts
 
Last edited:
If your WOL requirements are really simple you could probably do away with the WOL script altogether and just put ether-wake in the cru command.

So your services-start script would look something like this:
Code:
#!/bin/sh
cru a WOL "00 23 * * * /usr/bin/ether-wake -b -i br0 xx:xx:xx:xx:xx:xx"
 
Last edited:

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top