A Tern plugin that watches the systemd user timers on the machine your panes run on. It lists every systemctl --user timer with the service it starts, plus any user service that has failed, and toasts when a job fails or recovers.
- Jobs block: one row per job with its last result (
exit 3 · 8h ago,running 2m,ok · 40s ago) and its next run. Failed jobs sort first, then running ones, then by next run. - Details: the selected job's description, last start, run time, result, next run and timer.
- Last-run log: Enter shows the journal of the selected job's most recent run.
- Run now:
stwice starts the selected job. - Toasts: once per failure, and again when a job that failed later succeeds. The block's title counts failed or running jobs (
Jobs · 1 failed).
- Tern with plugin support (developed and tested against Tern 0.9.5).
- A Linux host with a systemd user manager, systemd 251 or newer (
systemctl --timestamp=unix). - Per-run logs need
journalctl --invocation(systemd 257 or newer). With an older journalctl, the log shows the unit's most recent lines across runs and says so.
Run this in a Tern pane on the machine whose timers you want to watch:
tern plugin install github.com/eggpeat/tern-jobsThe plugin has only a host half: it runs where your panes run. For a remote host attached to your Tern window, run the install in a pane on that host, not on the machine showing the window.
Open the command palette and run New Jobs block.
| Key | Does |
|---|---|
↑ ↓ / k j |
Move |
Home End / g G |
First / last job |
Enter / l (or double-click) |
Show or hide the selected job's last-run log |
s, then s again within 5 s |
Start the selected job now (systemctl --user start --no-block) |
r |
Refresh now |
Esc |
Close the log |
The list refreshes every minute, and every 15 seconds while a job is running.
A Tern host plugin can only toast through one of its blocks, so failure and recovery toasts arrive while at least one Jobs block is open. Tern's session daemon keeps the block and its polling running while no window shows it, so a Jobs block left in a tab keeps watching. Each failure toasts once, keyed by its exit time, and the record survives restarts. A recovery toasts when a run that ended after the failure succeeds, or, for a service no timer starts, when it is running again (a restarted daemon). systemctl --user reset-failed alone stays quiet. A failed service stays in the list until one of these happens, even after it leaves systemd's failed state. One gap: systemd unloads a service no timer starts as soon as it finishes successfully (unless it sets RemainAfterExit=yes), so such a one-shot job leaves the list without a recovery toast.
Every command is started as an argument vector, never through a shell, with a 20-second timeout and with SYSTEMD_COLORS=0, SYSTEMD_PAGER= and SYSTEMD_URLIFY=0 (plain output) and LC_ALL=C.UTF-8 (untranslated messages, so the plugin can tell when journalctl lacks --invocation) set:
| When | Command |
|---|---|
| Each refresh | systemctl --user list-timers --all --output=json --no-pager |
| Each refresh | systemctl --user list-units --all --type=service --state=failed --output=json --no-pager |
| Each refresh | systemctl --user show --timestamp=unix --no-pager --property=… -- <units>, for the listed units plus failures already toasted |
| Enter | journalctl --user --unit=<unit> --invocation=0 --lines=80 --no-pager --no-hostname --output=short-iso (the log view keeps the last 64 KB) |
s twice |
systemctl --user start --no-block -- <unit> |
Unit names come from systemd's own output, or from the plugin's own notified record, and are checked against systemd's unit-name character set (no leading -) before they reach a command line. The plugin makes no network requests. The only thing it writes is notified in its Tern key/value store (plugin-data/jobs/kv.json): the unit names of failed jobs and the exit times already toasted. Like any Tern block, the Jobs block's saved state (the selected unit and the unit whose log is open) is kept with the pane by Tern's session daemon.
- Anyone who can type into a Tern pane on the host, including attached remote, web and iOS clients, can start a listed job with
s s. That is the same reach a shell in that pane already has. - The log view shows what
journalctl --usershows you. If your jobs print secrets, the log view displays them, in every window attached to the session, Tern's web and iOS clients included. - Installing any Tern plugin runs its code with your user's permissions; read
host.luauandlib/jobs.luaubefore you install.
Report security problems privately through this repository's Security → Report a vulnerability page.
git clone https://github.com/eggpeat/tern-jobs
tern plugin link tern-jobs # use the checkout in place
tern plugin reload # after editingChecks (CI runs the same ones with pinned versions):
tern plugin types . # writes tern.d.luau for luau-lsp
luau-lsp analyze --definitions=tern.d.luau host.luau lib/jobs.luau tests/jobs.test.luau
luau tests/jobs.test.luau
stylua --check .lib/jobs.luau holds everything that doesn't touch Tern: parsing systemd's output, job states and ordering, toast decisions and formatting. host.luau runs the commands, polls and draws the block.