Keeping SSH sessions alive with systemd-inhibit
3 days ago
- #systemd-inhibit
- #bash-aliases
- #remote-sessions
- Using systemd-inhibit to prevent a desktop from sleeping during remote sessions.
- Workflow involves SSH and tmux, with system going to sleep after 30 minutes of inactivity.
- systemd-inhibit blocks sleep until the specified command exits, but requires a long-running process.
- Solution involves creating a background process with 'sh & disown' and capturing its PID.
- Aliases 'block' and 'unblock' simplify the process of inhibiting and allowing sleep.
- Validation of inhibition status can be done with 'systemd-inhibit --list'.
- Alternative solutions like 'caffeine' exist but the bash method offers more control.