Shadows the system shutdown binary and refuses to run if tmux or screen sessions are alive on the machine.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-31 17:40:00 +02:00
bin Initial commit 2026-08-31 17:40:00 +02:00
README.md Initial commit 2026-08-31 17:40:00 +02:00

shutdown

Shadows the system shutdown binary and refuses to run if tmux or screen sessions are alive on the machine.

Installation

tpm install shutdown

Make sure ~/.tpm/bin is prepended to your PATH, otherwise the real binary wins.

Usage

shutdown now                      # checks for sessions, then sudo shutdown
shutdown -h +10                   # arguments are forwarded as-is
shutdown -c                       # always forwarded, never blocked

If a tmux or screen session is running:

error: des sessions sont en cours : tmux
0: 3 windows (created Mon Aug 31 10:12:04 2026)
error: détache ou ferme ces sessions avant de relancer shutdown

Notes

  • Sessions are detected with pgrep across all users, not just yours — a shutdown kills everyone's sessions.
  • shutdown -c (cancel a scheduled shutdown) always goes through, so the guard can never lock you out of cancelling.
  • The real binary is called with sudo and an absolute path, so you will be asked for your password. This is intentional (no NOPASSWD): it also prevents accidentally shutting down from a shell history misclick.
  • Works over interactive SSH sessions. ssh host "shutdown now" is not supported (no TTY for sudo, and .zshrc is not sourced) — connect first, then run the command.