Skip to main content

py-simple-service-manager

py-simple-service-manager lets you manage a one-line command as a service on Linux, Windows, and macOS.

The same Python runner handles command execution, retry attempts, status files, and stdout/stderr logs. Platform backends only register and control the runner:

  • Linux: systemd units controlled by systemctl
  • Windows: Task Scheduler tasks controlled by schtasks and PowerShell
  • macOS: launchd agents/daemons controlled by launchctl

Install

python -m pip install -e .

Administrator relaunch support uses py-admin-launch for Windows UAC, Linux pkexec/sudo, and macOS osascript/sudo.

Startup modes

  • manual: do not start at boot.
  • auto: start once at boot after network components are available.
  • auto-retry: start at boot and retry after K seconds up to N times when the command exits with a non-zero code.

The retry count is handled by this package's runner, so it works consistently across all supported platforms.

pssm logs and the GUI log tabs read the current log files, not only completed runs. The runner flushes stdout/stderr to disk as bytes arrive, and Python commands are launched with unbuffered output automatically.

Usage

Register a manual service:

pssm add api -- python -m http.server 9000

Register a boot service:

pssm add api --mode auto -- python -m http.server 9000

Register a boot service with retry:

pssm add worker --mode auto-retry --retry-delay 10 --retry-limit 5 -- python worker.py

Set a per-run timeout, or use None for no time limit:

pssm add api --timeout 30 -- python -m http.server 9000
pssm edit api --timeout None

Change startup mode later:

pssm mode worker manual
pssm mode worker auto-retry --retry-delay 10 --retry-limit 5

Inspect and control services:

pssm list
pssm status worker
pssm logs worker
pssm logs worker --stream stderr --lines 100
pssm start worker
pssm stop worker
pssm remove worker

Edit the same fields exposed by the GUI:

pssm edit worker --command "python worker.py --queue default" --cwd /path/to/app
pssm edit worker --mode auto-retry --retry-delay 10 --retry-limit 5 --timeout 60
pssm edit worker --clear-cwd

Open the GUI:

pssm gui
pssm-gui

The GUI supports listing services, creating services, editing command/startup mode/retry settings/timeout/working directory, deleting services, starting and force-stopping services, viewing stdout/stderr, and viewing start history. The selected service status shows whether the current run is still active and how many seconds it has been running. Anything the GUI can change is also available through the CLI.

Show storage paths and platform details:

pssm doctor

Services are managed in system scope. Commands relaunch with administrator/root privileges automatically when needed.

Platform notes

Linux

Linux requires systemd and systemctl.

  • System scope writes units to /etc/systemd/system.
  • Boot startup uses network-online.target with Wants= and After=.

Windows

Windows uses Task Scheduler.

  • Services are registered as system tasks:
pssm add name --mode auto -- your-command

System-scope tasks run as SYSTEM with highest available privileges. Make sure the command and Python environment are available to that account.

macOS

macOS uses launchd.

  • System scope writes LaunchDaemons to /Library/LaunchDaemons.
  • Boot startup maps to RunAtLoad=true.

Development

Run tests from source:

PYTHONPATH=src python -m unittest discover -s tests -v

On Windows PowerShell:

$env:PYTHONPATH = "src"
python -m unittest discover -s tests -v

Metadata

Release files for py-simple-service-manager 0.1.20

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-simple-service-manager 0.1.20
File Size Uploaded
py_simple_service_manager-0.1.20.tar.gz 170.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-simple-service-manager 0.1.20
File Interpreter ABI Platform
py_simple_service_manager-0.1.20-py3-none-any.whl Python 3 none any Details

Total release size: 407.6 kB

Release files / py_simple_service_manager-0.1.20.tar.gz

Download URL py_simple_service_manager-0.1.20.tar.gz
Size 170.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c0a9940ddd13e6b031b2ee239ebadd603da6f7b4a56e77a7ac2ffda1f6ce56d0
BLAKE2b-256 checksum
How to use checksums
0759bf730401ebef6f769aaf1b990a512a27d4d44c3e44d54432c98479e6ae61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.11.15 Windows/10

Release files / py_simple_service_manager-0.1.20-py3-none-any.whl

Download URL py_simple_service_manager-0.1.20-py3-none-any.whl
Size 236.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3c50eac76c53e9b418bfc8344f38cac9e57be89deff6e1f8e1a763324370998
BLAKE2b-256 checksum
How to use checksums
9e098d627bd8e68519167674d9786fc74edf968a828803187cbef1852acbc26c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.11.15 Windows/10

Release history Release notifications | RSS feed

This release

0.1.20 This release

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page