Irgendwas Mit Blog

How To Boot Your PC When You Get Home

In this posting, I will show you my setup how I got my Android phone to boot my desktop PC as soon as I get home. You’ll need a running computer in the same network to send the appropriate message, which is in my case a Raspberry Pi. Your mainboard needs to support the Wake-On-Lan feature, but most modern ones do this. Your Raspberry Pi needs to be in the same network as your PC because the Wake-On-Lan packets cannot be routed.

My code is on Github. It may have seen some changes since I wrote this posting. Some little command line knowlegde should be enough to be able to do this.

The first step is to fork (or simply clone) my repository onto your Raspberry: git clone https://github.com/wasmitnetzen/bootIt. If your raspberry is not reachable from the internet, do the same on the server which is.

Setting up your Etherwake

Once you have enabled Wake-On-Lan (a good german guide for Linux can be found in the Ubuntusers wiki. Other OSes and languages can be found via a simple Google search. If you know one, let me know and I will link them here.) adjust the MAC address in the wakeIt.sh file you cloned. Then, to try if Wake-On-Lan works, enter ./wakeIt.sh. Your PC should boot up now. If you need to enter your password, you need to allow etherwake to be executed without doing so. If the script runs without password prompt, you can jump over the next two paragraphs.

Edit your sudoers file:
sudo nano /etc/sudoers
If your username is present, adjust its line so that looks roughly like mine or add the line like this if your username is not there:
florin ALL=(ALL) NOPASSWD: /usr/sbin/etherwake

Log out and in again and try again executing the script. wakeIt.sh should run now without a password prompt.

Setting up your Webserver

In my case, my Raspberry does neither run a webserver nor it is reachable from the internet. It is only reachable via SSH from a server in the internet, but this does not make a big difference anyway. Copy the remote.php to a location where your web server can access it.

Edit the remote.php, change the password and uncomment the line which is appropriate for your setup by removing or adding a # in front. You can now try to access the file and your PC should boot up.

Setting up your Android

I use the highly recommendable Llama app and the Locale plugin HTTP Poster. Luckily, Llama can use Local plugins.

Set up the appropriate conditions (scanning an NFC tag in my case, but you can set entering a region as well or anything else you like.) and add the action „Locale plugin“, choose HTTP post and enter the address as shown in the image.

2014-05-17 17.21.50

Now you can test the actions. Your PC should start now!

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert