Remotely Power on Linux from your Mobile
I run a FreeBSD/Samba-based file server at home with writable and read-only shares. This ensures a central location for important files such as music, which are accessable via cable or wirelessly to devices such as workstations, laptops, and mobile smartphones. However in these days of increasing power bills I don't need the server to be on all the time. This script will demonstrate how to remotely power-on a Unix/Linux system from another device, including Android and MS Windows.
WoL is a feature supported by modern computers which allows them to be booted remotely, by sending them the relevant data packets. When WoL is enabled, the computer may seem to be completely powered off, but in fact the onboard network controller chip (or network card) still has some power and is listening for the so called magic packet code which will start the system. This is not related to any suspend or hibernation-type modes - the system is otherwise completely turned off.
WoL was developed by Intel and IBM and has been around since 1997. It is supported by most versions of Unix, Linux and MS Windows. I have used WoL with FreeBSD servers without the need for any configuration. To install under Ubuntu/Mint and similar distros, run the following command:
sudo apt-get install wakeonlan
Waking up the remote server
Note that although you can send the WoL command via a wirelessly connected device, the target system must be connected to the network by cable. Wake-on-Lan uses port 7 by default and is directed at the MAC Address of the target system.
1. From another Unix/Linux system..
Run the following command:
wakeonlan -p 7 00:64:09:1a:fe:9b
I have incorporated the above command into a shell script to be run from my SysAdmin Menu
To find the MAC Address (aka physical address, hardware address) of the target system, run the ifconfig command and note the HWaddr..
2. From an Android phone..
Install the free Depicus Wake-on-Lan for Android via the Google Play Store.
Enter the MAC Address and IP Address of the target system and simply press "Wake Up"..
3. From MS Windows..
These links explain how to power up a system using Depicus WoL, from Windows OS..
Shutting it down again
Check out Remotely Power off Linux from your Mobile to see how to shut down the server from various devices.