runspec-scheduler
Cron, but limited to runspec runnables installed in one venv.
Shared, always-on schedules for the runnables installed in one venv, independent of any desktop console. Each venv picks a backend:
cron(default):syncwrites marked lines into the user crontab. Nothing else runs.daemon: a long-runningrunspec-scheduler runper venv fires the schedules itself. It addseveryintervals,catch_up, a heartbeat thatstatusreads, and a missed fire is recorded instead of lost.
Either way every fire runs runspec exec --label sched:<id> --lock …, so it is
one recorded run (exit code + captured output) in the venv's History. It is
itself a runspec runnable, so runspec-console can detect it, 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, as the venv owner:
pip install runspec-scheduler
runspec-scheduler use daemon # skip this to stay on host cron
runspec-scheduler install-service # shows the keeper it would set up
runspec-scheduler install-service --write # sets it up and starts the daemon
The daemon runs as the venv owner, one per venv. Something has to start it at
boot and restart it when it dies: the keeper. install-service picks one
(--manager auto) or takes the one you name:
--manager |
needs | what it sets up |
|---|---|---|
systemd-user |
lingering on, systemd newer than 219 | ~/.config/systemd/user/runspec-scheduler-<venv>.service, enabled with systemctl --user enable --now |
supervisor |
pip install 'runspec-scheduler[supervisor]' |
supervisord inside the venv ({venv}/supervisor/), started at boot and checked every 5 minutes from your crontab |
cron |
crontab | run --detach at boot and every 5 minutes; a second start is a no-op, so a crashed daemon is back within 5 minutes |
systemd |
root, once | a system unit with User=<owner>; only printed (root runs the steps it lists), never written to /etc |
auto takes systemd-user when lingering is on and the --user manager
answers, else supervisor when supervisord is in the venv, else cron, and
says why. --manager supervisor --system prints a program block for the host's
own supervisord instead.
Nothing changes without --write: the result lists the files, crontab lines,
commands and the steps root has to run. Crontab lines are tagged
# runspec:scheduler-keeper:<venv>, separate from the cron backend's lines.
runspec-scheduler install-service --remove # what removing would do
runspec-scheduler install-service --remove --write # remove every keeper, stop the daemon
Run --remove --write before deleting a venv, so no keeper restarts a daemon
from a folder that is gone. status lists the keepers under keeper.
After upgrading runspec-scheduler, restart the daemon so it runs the new code
(status shows restart_needed until you do). restart goes through the
keeper the venv has: systemctl --user restart, supervisorctl restart, or
for the cron watchdog (or no keeper) stop + run --detach. Fires already
running carry on and are still recorded. A system unit only root can restart.
runspec-scheduler restart --dry-run # what it would do
runspec-scheduler restart # restart, wait for the first heartbeat
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
ask root to enable lingering:
sudo loginctl enable-linger serviceacc
sudo -iu serviceacc runspec-scheduler install-service --manager systemd-user --write
sudo -iu serviceacc systemctl --user status runspec-scheduler-<venv>
If lingering is already on, install-service recovers XDG_RUNTIME_DIR from
/run/user/<uid> on its own; otherwise it returns a hint with the commands
above. Without root, use --manager supervisor or --manager cron.
Use
runspec-scheduler add --id nightly --runnable backup --cron '0 2 * * *'
runspec-scheduler add --id poll --runnable healthcheck --every 15m --args '{"level":"warn"}' # daemon only
runspec-scheduler add --id report --runnable report --cron '0 6 * * *' --timeout 30m --catch-up
runspec-scheduler list
runspec-scheduler status
runspec-scheduler run-now --id poll
runspec-scheduler run-now --id nightly --detach # start it in the background and return
runspec-scheduler remove --id poll
runspec-scheduler use daemon # or: use cron
- Exactly one of
--cron(5-field cron) or--every(15m/1h/1d; daemon backend only). --argsis a JSON object passed to the target runnable.--timeoutstops a fire that runs longer (daemon default6h;0= no limit).--catch-upruns one fire straight away when the daemon starts after that schedule's fire was due (it was down, the host rebooted). Without it a missed fire is recorded asskipped.- The daemon picks up config changes within a few seconds, or at once on
SIGHUP. On the cron backend runsyncafter editing. run-now --detachstarts the fire as a scheduled fire would run it (the schedule'srun_ason cron, the venv owner on the daemon) in its own session, so it carries on after you log out; its run is recorded like any other fire.- Every fire's run carries a trigger saying what started it:
schedule:cron,schedule:daemonorschedule:run-now.
Config
Schedules live in {venv}/runspec_scheduler.toml (override with --config or
$RUNSPEC_SCHEDULER_CONFIG):
[scheduler]
backend = "daemon" # or "cron" (default)
timeout = "6h" # default per fire; 0 = no limit
misfire_grace = "5m" # a fire later than this is recorded as missed
catch_up_window = "1d" # how far back catch_up looks
[[schedule]]
id = "report"
runnable = "report"
cron = "0 6 * * *"
timeout = "30m"
catch_up = true
Change the [scheduler] durations with settings (the daemon reloads them by
itself; use switches the backend):
runspec-scheduler settings # show them
runspec-scheduler settings --timeout 2h --misfire-grace 10m # change two
The daemon writes a heartbeat to {venv}/logs/scheduler_state.json and a
rotating log to {venv}/logs/scheduler.log; runspec-scheduler status reads
both. Only one daemon runs per venv (an flock on runspec_scheduler.lock).
A fire that times out is stopped by runspec exec, then the daemon kills what is
left of its process group. For a run_as fire escalated through sudo, children
running as that other account can outlive the timeout.
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.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| runspec_scheduler-0.7.0.tar.gz | 95.4 kB | With provenance | Details for runspec_scheduler-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| runspec_scheduler-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for runspec_scheduler-0.7.0-py3-none-any.whl |
Total release size: 164.8 kB
Release files / runspec_scheduler-0.7.0.tar.gz
| Download URL | runspec_scheduler-0.7.0.tar.gz |
|---|---|
| Size | 95.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63539b5a326d10f1eb9fb28be85c34e2a862aba96505482b475dfbbe6361ac07
|
|
BLAKE2b-256 checksum How to use checksums |
d80402a252969d5bb7ebc2436b813591bfe5735bf7a8fede6951bcb1659c0dcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 7, 2026.
Transparency logRelease files / runspec_scheduler-0.7.0-py3-none-any.whl
| Download URL | runspec_scheduler-0.7.0-py3-none-any.whl |
|---|---|
| Size | 69.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd335df08814b522ce7727f95db9912bed008452328af9adf8d1ae6ed1438874
|
|
BLAKE2b-256 checksum How to use checksums |
cde186ab3be161e986d2c6a62a375018ca49efe5fbfafcbbc262bb40777fcac8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 7, 2026.
Transparency logSecurity for runspec-scheduler 0.7.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for runspec_scheduler-0.7.0.tar.gz
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 Nov 7, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.