Skip to main content

runspec-scheduler

Cron, but limited to runspec runnables installed in one venv.

A long-running per-venv scheduler daemon (systemctl --user) that runs runnables installed in its own venv on a cron/interval cadence — independent of any desktop console. It is itself a runspec runnable, so runspec-console can detect it and manage its schedules over SSH, but discoverable = false keeps it out of the Forms tab / runspec serve MCP surface.

Why

A console-driven schedule only fires while the desktop console is open, and it's per-operator. runspec-scheduler gives you shared, always-on schedules that live on the host and run whether or not a console is connected.

Install

# Into the same venv whose runnables you want to schedule:
pip install runspec-scheduler

# Install + enable the systemd --user service for this venv (as yourself):
runspec-scheduler install-service
loginctl enable-linger "$USER"     # survive logout

install-service writes ~/.config/systemd/user/runspec-scheduler-<venv>.service (one daemon per venv) and runs systemctl --user enable --now. To do it by hand, see deploy/runspec-scheduler.service.

Running the daemon as a service account

systemctl --user needs the account's own user session (XDG_RUNTIME_DIR + D-Bus). A bare sudo -u <acct> doesn't set that up, so systemctl fails with "Failed to connect to bus: No medium found." Run from a login shell and enable lingering:

sudo loginctl enable-linger serviceacc              # persistent user systemd, survives logout
sudo -iu serviceacc runspec-scheduler install-service   # -i = login shell (sets up the session)
sudo -iu serviceacc systemctl --user status runspec-scheduler-<venv>

The -i (login shell) is what wires up XDG_RUNTIME_DIR, D-Bus, and HOME for the account. If lingering is already on, install-service also recovers XDG_RUNTIME_DIR from /run/user/<uid> on its own; otherwise it returns a hint with the exact commands above (the unit file is written either way, so you can finish with a manual systemctl --user enable --now).

Use

runspec-scheduler add --id nightly --runnable backup --cron '0 2 * * *'
runspec-scheduler add --id poll   --runnable healthcheck --every 15m --args '{"level":"warn"}'
runspec-scheduler list
runspec-scheduler run-now --id poll
runspec-scheduler remove --id poll
  • Exactly one of --cron (5-field cron) or --every (15m / 1h / 1d).
  • --args is a JSON object passed to the target runnable.
  • Adding/removing a schedule hot-reloads the running daemon (mtime poll, ≤ 5s).

Config

Schedules live in {venv}/runspec_scheduler.toml (override with --config or $RUNSPEC_SCHEDULER_CONFIG). The daemon keeps a rotating audit log at {venv}/logs/scheduler.log; live logs via journalctl --user -u runspec-scheduler-<venv> -f.

Credentials (run_as runnables)

runspec-console can attach service-account credentials to a remote schedule. For a runnable that declares run_as, the selected credentials are written to a 600 env file owned by the run_as account in that account's home; the daemon points RUNSPEC_ENV_FILE at it and escalates to run_as when firing. Credentials are never placed on a command line. This requires the daemon/SSH user to have passwordless sudo -u <run_as> (the same precondition as running that run_as runnable at all).

Runnables without run_as run as the daemon's own user with the daemon's environment (systemd EnvironmentFile) — no console credential injection.

Metadata

Release files for runspec-scheduler 0.3.0

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

Source distribution (sdist)

Source distribution for runspec-scheduler 0.3.0
File Size Uploaded
runspec_scheduler-0.3.0.tar.gz 42.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for runspec-scheduler 0.3.0
File Interpreter ABI Platform
runspec_scheduler-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 79.6 kB

Release files / runspec_scheduler-0.3.0.tar.gz

Download URL runspec_scheduler-0.3.0.tar.gz
Size 42.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f90499e3d85b43720c9c369a3c6f2cb32fd4a29fb11c784c917239c11315b657
BLAKE2b-256 checksum
How to use checksums
de1ddb1112b8e4c92ea416ea9562cbd3fe1ec5e5bb78d10d5cff88e740dee0c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / runspec_scheduler-0.3.0-py3-none-any.whl

Download URL runspec_scheduler-0.3.0-py3-none-any.whl
Size 37.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
525a9a8750e09d8e9b7f88ed5d88e6a668a85bf9e615da7b1db8b730f9ee5749
BLAKE2b-256 checksum
How to use checksums
bbbadc39ce75cdd83dc2c368195e00b07a33cab70cc3444429e73a95036855f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.1

2 release files

0.4.0

2 release files

This release

0.3.0 This release

2 release files

0.2.0

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