Skip to main content

System suspend inhibitor

Project description

Inhibit.py

Systemd Inhibitor - Prevent system shutdowns and sleep states via stdin ON/OFF commands.

This script creates a systemd inhibitor that can be controlled via stdin. It reads ON/OFF commands from standard input and toggles the inhibition accordingly. This is useful for preventing system shutdowns and sleep states when controlled by external processes through pipes.

Basic Usage:

    # Just an example of valid input values.
    echo "ON" | inhibit
    echo "OFF" | inhibit

    # In practice, an external process emits these values.
    some_process |inhibit

    # Common arguments
    inhibit --what sleep --who "my-app" --why "processing data"

The script uses systemd's logind interface to create inhibitors for:

  • sleep: Prevent system sleep/suspend
  • idle: Prevent automatic idle detection

For detailed command-line options, use --help.

Requirements

System requirements

These must be available and installed

  • dbus-python
  • systemd

Installing

Important: tool assumes that system provides dbus-python package.

Alternatively you can install dbus-python manually.

$ python -m venv --system-site-packages venv
$ source venv/bin/activate
$ python -m pip install inhibit
$ inhibit --version
inhibit 0.1.0

To install the package, it's recommended to use the Linux distribution default package manager.

Development

Requirements

  • uv
  • just
  • reuse
  • tox

Build

  • just check
  • just build

See Justfile.

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

inhibit-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inhibit-0.1.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file inhibit-0.1.0.tar.gz.

File metadata

  • Download URL: inhibit-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for inhibit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 47eb39abbd6a244fdbd6ece5f0e2915e5f71a1e731d398609be0120ad1c50a7b
MD5 3c2d1f430c2f03133272735b5d2b19ca
BLAKE2b-256 2bc2041c923d4566baa13770f7b06bce1597a370754fa22c9286e6fa61f458ba

See more details on using hashes here.

File details

Details for the file inhibit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: inhibit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for inhibit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d6b77da0988110d169683cb87aa53c33ba3b3d2cb2ea4c06c81cda20a97938d
MD5 7f3480b4494e5933950c3e449172b9b1
BLAKE2b-256 4da9c55e7510ad1240ecc248e79ac7643d256e1daa7ee4a5a3629fccf56c9d27

See more details on using hashes here.

Supported by

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