computer is on, it's on. lid close, screen is off. done.
If you want to be extra fancy, you could even write small program that calls the dbus api directly and then just waits to be killed. Avoids the turducken of waiting processes.
https://www.golinuxcloud.com/keep-alive-ssh-sessions-in-linu...
The author wants xyr system to not suspend when either there's someone active on the GUI or when xe is logged in over the network. Theoretically, systemd already has a whole mechanism for making this happen.
The pam_systemd.so hook into PAM allows systemd-logind to track SSH sessions in its replacement for the Unix login database — all of that stuff under /run/systemd/users/, /run/systemd/seats/, and /run/systemd/sessions/. And in theory systemd-logind could respond negatively to a suspend request if there is an active SSH login session even if the GUI is idle.
In practice, it does not quite have the logic for achieving this.
* https://github.com/systemd/systemd/blob/main/src/login/login...
* https://github.com/systemd/systemd/blob/main/src/login/login...
blueflow•1h ago
Consider disabling suspend from the logind.conf and suspend, if at all, only at explicit user request.
jon-wood•1h ago
jeroenhd•1h ago
It's more that when you configure systemd to suspend your computer when there is no physical activity, it will suspend your computer when there is no physical activity.
The author wants their computer to suspend automatically.
I think modifying your system configuration to never suspend is a much worse solution than using the tool designed to prevent suspending the computer while a specific program is running to prevent suspending the computer while that specific program is running.
It'd be easier if `sshd` would permit you to wrap the incoming command line/shells so `sshd` would spawn your session with systemd-inhibit, but I don't think that's possible?
blueflow•47m ago
> It'd be easier if `sshd` would permit you to wrap the incoming command line/shells so `sshd` would spawn your session with systemd-inhibit, but I don't think that's possible?
sshd already links against systemd (by distro patches, not per upstream) but since SSH is a "legacy protocol" and its users are "uneducated troglodytes", this is not going to happen.
I think this is because OpenSSH is an OpenBSD project, and both systemd and OpenBSD refuse to support each other.