Skip to main content

Remote computer awake (rawake)

Project description

Remote Computer Awake (rawake)

Installation

$ pip install -U rawake # install latest version
$ rawake --version # verify installation

Configuration

The rawake configuration is a python-base configuration file. Configuration should be stored at ~/.config/rawake/config.py

Example:

from rawake.config import Config, Computer

DEFAULT_SSH_SUSPEND_COMMAND = "sudo systemctl suspend"

CONFIGURATION = Config(
    computers=[
        Computer(
            name="remote-server",
            ip_address="192.168.0.10",
            mac_address="22:1b:5c:44:12:6b",
            ssh_port=2222,
            ssh_suspend_command=DEFAULT_SSH_SUSPEND_COMMAND,
        ),
        Computer(
            name="other-server",
            ip_address="192.168.0.200",
            mac_address="a4:44:c3:61:10:b8",
            ssh_suspend_command="sudo shutdown -h now",
        ),
    ],
)

Listing the configuration

$ rawake --list
[
  {
    "name": "other-server",
    "mac_address": "a4:44:c3:61:10:b8",
    "ip_address": "192.168.0.200",
    "ss_suspend_command": "sudo shutdown -h now",
    "ssh_port": 22
  },
  {
    "name": "remote-server",
    "mac_address": "22:1b:5c:44:12:6b",
    "ip_address": "192.168.0.10",
    "ss_suspend_command": "sudo systemctl suspend",
    "ssh_port": 2222
  }
]

Suspend remote computer:

rawake requires a username:password SSH connection to the remote host to be able to execute the configured suspend command.

$ rawake --suspend remote-server
SSH authentication:
username:username
password:<password>

Awake remote computer:

For awaking a remote computer, rawake sends a Wake-On-Lan magic packet.

rawake --awake remote-server

Development

Python dev environment:

  • Create new Python virtual environment:

    pyenv virtualenv 3.11 rawake
    
  • Activate the virtualenv:

    pyenv activate rawake
    
  • Install dev and test dependencies:

    • pip install .[dev]
    • pip install .[test]
  • Install git pre-commit hooks

    • pre-commit install
    • pre-commit autoupdate

Running the tests:

pytest .

Project details


Download files

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

Source Distribution

rawake-0.1.1.tar.gz (9.3 kB view hashes)

Uploaded Source

Built Distribution

rawake-0.1.1-py3-none-any.whl (7.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page