Files
claude-foundations/config/systemd/user/claude-sessions-save.service
Paul O'Reilly 53170c320e feat: add systemd service config and install script
config/systemd/user/claude-sessions-save.service: source of truth
for the shutdown service, version-controlled alongside the scripts
it calls.

scripts/install-systemd.sh: idempotent install script — copies the
service file to ~/.config/systemd/user/, reloads the daemon, and
enables + starts the service. Run on any new machine to wire up
graceful Claude session shutdown.
2026-10-12 16:11:18 +13:00

19 lines
667 B
Desktop File

[Unit]
Description=Gracefully exit Claude Code sessions before shutdown
Documentation=https://github.com/oreillyit/claude-foundations
# Run before the system begins tearing down the session
Before=shutdown.target halt.target reboot.target poweroff.target
[Service]
Type=oneshot
RemainAfterExit=yes
# ExecStart is a no-op — the service exists purely for its ExecStop
ExecStart=/bin/true
# On stop (triggered at shutdown): gracefully exit all Claude tmux sessions
ExecStop=%h/dev/claude/projects/claude-foundations/scripts/claude-sessions-shutdown
# Allow up to 120s for Claude sessions to save and exit cleanly
TimeoutStopSec=120
[Install]
WantedBy=default.target