After setting up my router to run dd-wrt I’ve used PuTTy to ssh into the router to start my desktop machine to work on it through a RDP session.
After spending months looking up the correct MAC address in my phone and typing the commands by hand I finally took a bit of time to write a small bash script on the router so that I could simply run the script each time I needed it.
On my router (WRT54GL) there’s a bit of space in the /jffs folder that’s usable for storing scripts.
To write a script named “wol” go to the correct directory and type:
VI opens in command mode. To start editing press the INSERT key. At the bottom left of the screen a “I” will be displayed. The editor is now in editing mode. I just wrote:
echo “Waking up 19\” system”
/usr/sbin/wol -i 192.168.100.255 -p 9 xx:xx:xx:xx:xx:xx
Where xx:xx:xx:xx:xx:xx is the MAC address of my network card.
To get back in command mode press ESCAPE.
Then to save the file and exit type:
:wq and ENTER. (the semicolon starts the command, wq stands for write and quit).
This creates the script, the only thing left is to make is executable:
chmod 700 wol
From now on, the script can be started by going to the correct directory and typing:
The script will be called and run the commands. If there are any error messages they will be displayed.