Skip to content

Add systemd timer as alternative auto-save mechanism#157

Open
Marcel-Bich wants to merge 1 commit intotmux-plugins:masterfrom
Marcel-Bich:feature/systemd-timer-autosave
Open

Add systemd timer as alternative auto-save mechanism#157
Marcel-Bich wants to merge 1 commit intotmux-plugins:masterfrom
Marcel-Bich:feature/systemd-timer-autosave

Conversation

@Marcel-Bich
Copy link

Summary

Adds a systemd user timer as an alternative to the status-right #() based auto-save. This addresses the long-standing request in #99 to decouple auto-save from the status bar.

Problem

The current auto-save mechanism prepends #(continuum_save.sh) to status-right. tmux evaluates #() commands on every status refresh for every attached client. With N clients and a 5-second status-interval, that means N shell invocations every 5 seconds, each spawning multiple subprocesses for version checks, timestamp comparisons, and tmux queries.

This scales poorly:

  • 5 clients: 60 shell invocations/minute
  • 13 clients: 156 shell invocations/minute
  • 20+ clients: 240+ shell invocations/minute

Each invocation spawns ~10 subprocesses, creating thousands of context switches per second.

Solution

A systemd user timer that calls tmux-resurrect save directly, once every 15 minutes, regardless of client count. This is opt-in and documented in systemd/README.md.

Users who prefer the existing mechanism can continue using it unchanged.

Files added

  • systemd/tmux-resurrect-save.service - oneshot service
  • systemd/tmux-resurrect-save.timer - 15-minute timer
  • systemd/README.md - setup instructions

Closes #99

The default status-right based auto-save uses #() command substitution
that runs on every status refresh for every attached client. With many
concurrent sessions this causes CPU scaling issues.

This adds a systemd user timer that calls tmux-resurrect save directly,
once per interval, independent of client count.

Closes tmux-plugins#99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Find way to run automatically without depending on status bar and status-right

1 participant