Skip to content

 

Remote Power Switch – remotely power on or off a computer

(c) 2010 Clément Lorteau

Intro / Prerequisites / Usage / Bug reports / Licensing / Download

1. Intro

This little proggy i put together in 2 short days for powering off and on a computer. It works whether the computer is on the LAN or somewhere on the Internet. Power on is done with wake-on-lan, power off is done by issuing a shutdown command by SSH. It also monitors a TCP port to know if the machine is currently up or down.


2. Prerequisites

2.1 Architecture

- Wake-on-lan:

The remote machine needs to be able to be woke up by wake-on-lan through  the internet. Either it’s directly frontal to the internet, or its  internet gateway proxies wake-on-lan requests.

Either way, its public IP must understand UDP encapsulated WOL requests,  as it’s the only we way to receive WOL requests from the internet.

You can find an article in French describing how to achieve this here:

http://www.lorteau.net/blog/allumer-son-serveur-a-la-demande-par-internet

- SSH:

Power on is done by issuing a command by SSH, so the server needs to be  reachable by SSH both from the internet and from its LAN. RPS doesn’t  support password authentication; only private key authentication is  supported. Furthermore, issuing the command must not require additional  authentication (i.e. a password). See config.ini for details.

2.3 Software

- OS:

Being written in wxPython, RPS is platform independent. Linux and Windows  are supported. Mac OS X is supposed to work but was not tested as I don’t  have access to any OS X installation.

- Software:

Running the Windows .exe files doesn’t require anything (which is why the *.exe files are quite big for such a small app; they contain the whole python interpreter and libraries).

Running the source files requires Python (duh) and Paramiko.

3. Usage

3.1 Versions

There are 2 versions: the command line (remotepowerswitch-cli.* files) and the graphical interface (remotepowerswitch-gui.* files). Running these is done by launching either:

- the *.sh files if you’re running from the source under Linux

- the *.bat files if you’re running from the source under Windows

- the *.exe files if you’re running from the compiled Windows files

3.2 Options

- command-line interface:

Usage: remotepowerswitch-cli.* [options] action

Options:

-h, –help              Show this help message

-v, –version           Display version information

-c, –config=file       Use configuration file ‘file’. Default: config.ini

Actions:

on                     Power on the remote machine

off                    Power off the remote machine

check                  Check if the remote machine is on or off

- graphical interface:

Usage: remotepowerswitch-gui.* [options]

Options:

-h, –help              Show this help message

-v, –version           Display version information

-c, –config=file       Use configuration file ‘file’. Default: config.ini

3.3 Configuration

Configuration is done through a *.ini file. The provided config.ini file describes all the options. As the config file to use can be chose with a command line option, several config files can be written to control several computers.

4. Bug reports


Thanks to send bug reports to clem _AT_ lorteau.fr, or reply to this post.

5. Licensing

Remote Power Switch is licensed under the terms of the GNU General Public License. It’s free to use and you can modify it and redistribute it under certain conditions. Details of this license are provided in the LICENSE.txt file.


6. Download

- Python scripts (platform independant):

remotepowerswitch-src.zip (45 KB)

- Windows executables:

remotepowerswitch-win.zip (12 MB)

Partager :
  • Facebook
  • Twitter
  • Wikio FR
  • Google Bookmarks
  • Netvibes
  • Live
  • email
  • Print

One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Continuing the Discussion

  1. Remote Power Switch – allumer et éteindre son PC à distance | lorteau.(net|fr) linked to this post on 14 mai 2010

    [...] « remotepowerswitch-cli check ». Plus de détails et téléchargements sur la page du projet. Partager [...]



Some HTML is OK

or, reply to this post via trackback.