Skip to content

Instantly share code, notes, and snippets.

@mid-kid
Last active June 20, 2024 15:39
Show Gist options
  • Save mid-kid/e07ce562c46a0cce0f7b4238ed29666e to your computer and use it in GitHub Desktop.
Save mid-kid/e07ce562c46a0cce0f7b4238ed29666e to your computer and use it in GitHub Desktop.
Tmux user service for OpenRC
#!/sbin/openrc-run
user="${RC_SVCNAME##*.}"
name="${RC_SVCNAME%.*} daemon for user $user"
pidfile="/var/run/$RC_SVCNAME.pid"
command="/usr/bin/tmux"
command_args="-D"
command_user="$user:$user"
command_background=true
@mid-kid
Copy link
Author

mid-kid commented Jun 20, 2024

This allows running and persisting a tmux daemon with OpenRC, preventing it from being killed by elogind, and starting/persisting sessions from boot onwards. Copy this file to /etc/init.d and rename it to tmux.<yourusername>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment