Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Python utility to wake up(wol) and suspend Linux machines remotely

Project description

powertool

https://coveralls.io/repos/github/raghur/powertool/badge.svg?branch=master https://img.shields.io/pypi/v/powertool.svg https://travis-ci.org/raghur/powertool.svg?branch=master Documentation Status Updates https://img.shields.io/pypi/pyversions/powertool.svg

Python utility to wake up(wol) and suspend Linux machines remotely

  • Free software: MIT license

Features

  • Wake up remote machines using hostname/ip.
  • Suspend remote machines using hostname

Wake on lan (WOL)

Wake up feature uses WOL magic packet. Since mac addresses are hard to remember/use, this tool lets you wake up or suspend machines by their name or IP.

  1. First register your machines

    powertool register -b 192.168.1.255 aa:bb:cc:dd:ee:ff you@host
    
    • -b Broadcast_IP - this is the subnet on which your machine’s ip is. If your machine’s ip is 192.168.1.xxx, then this is 192.168.1.255(default)
    • aa:bb:cc:dd:ee:ff - your machines’ mac address. You can find this on your machine or on the router’s device list.
    • you@host - your username on the remote host - this is used by the sleep function to do a passwordless ssh and run pm-suspend.
  2. register saves machine details so that you can later do this:

    powertool wol host
    powertool sleep host
    
  3. register just saves machine details to a ~/.powertool as a json file.

Sleep/suspend

Sleep/suspend feature has quite a few dependencies

  • you should have password-less ssh to the remote host. There are a lot of guides on the internet on how to set this up - like this one http://www.linuxproblem.org/art_9.html. Verify that it works by running ssh user@host - you should not be prompted for a password.

  • You should have pm-utils package on your remote machine http://manpages.ubuntu.com/manpages/precise/man8/pm-action.8.html

  • Your user should be able to run sudo pm-suspend without being prompted for password. To set this up, login to the remote machine and do the following:

    sudo visudo
    # add the following - where user is your username on the remote machine
    user ALL=(ALL) NOPASSWD: /usr/sbin/pm-suspend
    

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.3.0 (2018-05-04)

  • Dependency updates

0.1.0 (2017-06-07)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for powertool, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size powertool-0.3.0.tar.gz (19.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page