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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file rawake-0.1.1.tar.gz.

File metadata

  • Download URL: rawake-0.1.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for rawake-0.1.1.tar.gz
Algorithm Hash digest
SHA256 20f11c9932a3b6f5e8838f85503f79a688385e7d4c909cee8e72822560d8c44b
MD5 24164ca7ec8c5b7e0d30c4a941514df6
BLAKE2b-256 3681bcdeacdefcca651fe54e122a5e0a30753e32182e9493df5baf8923cf43c0

See more details on using hashes here.

File details

Details for the file rawake-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: rawake-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for rawake-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5f4c7cf3b9becace5a15e69b01ed77d17503c9ba1290b8fdd4a7e3fe72b53e3d
MD5 53271931746dc198bf0303e72f726538
BLAKE2b-256 fe0065c1733d6ba9004cfe5edc522ee7263b2a3d1a087f7bc0d88eca34c69042

See more details on using hashes here.

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