Schedule delayed input to tmux sessions from a YAML file.
Project description
tmux-scheduler
tmux-scheduler is a CLI tool that reads a YAML schedule and sends input to tmux sessions after configured delays.
It uses libtmux to connect to the active tmux server and send keys to panes.
Install
poetry install
To enter the virtualenv shell:
poetry shell
Usage
poetry run tmux-scheduler -i schedule.yaml
Use -d or --dry_run to execute the schedule timing without sending any input to tmux.
The CLI uses rich logging to show each scheduled input before it waits and sends it, with highlighted delay and session fields and dimmed input text. Wait durations are rendered with humanize for easier reading. While each item is waiting, it also renders a Rich progress bar with elapsed time, remaining time, and a preview of the input being queued.
Schedule format
The input file must be a YAML list. Each item must define:
schedule: when to send the inputsession: tmux target to send input to, ornullto use the only running tmux sessioninput: text to send
The schedule field supports:
- a number, treated as seconds from now, for example
14400 - a relative time string parsed by
dateparser, for example"1 hour later" - a clock time string parsed by
dateparser, for example"23:00"
humanize is used for display formatting of wait durations in the CLI output. Schedule parsing still uses dateparser, because humanize does not parse natural-language schedule expressions.
For clock times like "23:00", if that time has already passed today, tmux-scheduler schedules it for the next day.
Targets are resolved in this order:
- session name, for example
worker - window target, for example
worker:0 - pane target, for example
worker:0.1or%3
If you target a session or window, input is sent to that target's active pane.
If session is null, tmux-scheduler will send the input to the active pane of the only tmux session. If tmux has zero sessions or more than one session, it raises an error.
Example:
- schedule: 14400
session:
input: |
export APP_ENV=dev
export LOG_LEVEL=debug
cd ~/projects/my-app
source .venv/bin/activate
python manage.py migrate
python manage.py runserver
- schedule: "1 hour later"
session: worker:0
input: python job.py
- schedule: "23:00"
session: worker:0.1
input: python job.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tmux_scheduler-1.0.0.tar.gz.
File metadata
- Download URL: tmux_scheduler-1.0.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.17.0-20-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7c74e5fcffaf37218f0583fb1d8a9fd464c5eb453cf02f0033bf366bb7e6756
|
|
| MD5 |
23db570909b1b16fb4f27c40fc9411d0
|
|
| BLAKE2b-256 |
dad1e3544a0103e17548744f12226983e15244e8ec173c1cb32be6252c29be31
|
File details
Details for the file tmux_scheduler-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tmux_scheduler-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.17.0-20-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a24b254a3a07f32b1c868296a9b6d8e098d6ae1e0314dc12747306400c197d8b
|
|
| MD5 |
90490ebaaf6e2935ac158eb7b17d16e8
|
|
| BLAKE2b-256 |
352f87582ea2812f1f56e7723a8e037dbe6a19ad1aefebcfabb3dde9b788f191
|