Turn on a remote computer
I have a machine that I use to do lot of work. However, I want to avoid having it on 24/7. Hence, sometiems I need to turn it on remotely to start working
Guide
To turn on your computer remotely, you need to be in the same network and then use the protocol "Wake-on-Lan." Read below for a step-by-step guide.
Be in the same network. I recommend having a Raspberry Pi on 24/7, which you can SSH into anytime. Alternatively, you can use a VPN to connect to your network (also via a Raspberry Pi).
SSH into the Raspberry
Create a directory for managing this operation.
# use wake on lan
mkdir remote_on
Find out the MAC address of your computer. You can do it. Then save it in file
MAC_ADDR
:
# use wake on lan
cd remote_on
echo "..." > MAC_ADDR
If not available, install a client to use Wake-on-Lan. I use etherwake.
Draft a script to do the job
# use wake on lan
MAC_FILE="$(dirname "$0")/MAC_ADDR"
etherwake -i eth0 "$(cat "$MAC_FILE")"
Make the script executable
chmod +x /home/pi/remote_on/script.sh
Add an alias to your
.bashrc
like:
alias turnon='sudo /home/pi/remote_on/script.sh'
Last updated
Was this helpful?