GDM make the workstation going standby even if connected remotely

Continuing the discussion from GNOME suspends after 15 minutes of user inactivity, even on AC power:

When connecting remotely to my fedora workstation, it goes into standby after 15 minutes.
I have the issue when connection via ssh, but also via the new gnome-remote-desktop feature.

From the post mentioned above I understand the reason why, and now I’m looking for the best way to workaround the issue.

any idea ?

thanks,
Julien.

So I could set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout to 0 and have the standby disabled completely.

But I’m wondering if there isn’t another way to prevent going in standby mode if some remote connections are still active.

Well, I’m not sure I want to completely disable this standby feature.

the following discussion shows some workaround using systemd-inhibit.
Disable suspend if SSH sessions are active - Help - NixOS Discourse

maybe something like this (for ssh)
Stopping a System with SSH Clients from Sleeping – Jérôme Belleman (jeromebelleman.gitlab.io)

Ideally I would expect some systemd magic could be used.

I found something like this which presumably inhibit suspend so long there is some samba activity

[Unit]
Description=Inhibit suspend in case of samba activity
Before=hibernate.target
Before=hybrid-sleep.target
Before=suspend.target
Before=smbd.service # who knows?


[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c "! smbstatus -nb | tail -n +5 | grep -q '^[0-9]*'"

[Install]
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target
WantedBy=suspend.target

As anybody something similar for ssh and/or gnome-remote-desktop ?

I am not certain there is any way to selectively have a system decide when to sleep or not sleep with remote connections active. I am also not aware of what changes may have been made to fix that.

I am aware that you can go into the gnome settings and disable the automatic suspend feature. I also made several changes on my system to totally disable the suspend/sleep/hibernate features since it began putting my desktop machine to sleep which needed to run 24/7 as a media server as well as other server functions.

One thing I did that totally halted the default suspend was to create a directory
/etc/systemd/sleep.conf.d/ and created this file with the displayed content in that location.
It worked and I have had no sleep/suspend occurrences since.

$ cat /etc/systemd/sleep.conf.d/sus-hib-off.conf 
[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no

I seem to recall there may have been some talk of using WOL (Wake-on-Lan) as part of that but have not seen much discussion.

I am not certain there is any way to selectively have a system decide when to sleep or not sleep with remote connections active. I am also not aware of what changes may have been made to fix that.

What I meant is that, I could imagine to use wol to start the PC remotely, then connect with ssh or gnome-remote-desktop
and then when I’m finished, I could just disconnect and the PC would go in sleep mode after 15 minutes.

But, as this does not seems possible, I think I will disable the sleep/standby completly and use crond to shutdown the PC on scheduled (at the end of the working hours).