[systemd-devel] suspend home server on idle / inactivity
Lennart Poettering
lennart at poettering.net
Tue Feb 10 12:47:00 PST 2015
On Mon, 09.02.15 21:52, Thomas Koch (thomas at koch.ro) wrote:
> first asked here: http://stackoverflow.com/questions/28399754
>
> I've setup my home server to wake-on-lan and my router sends the wake-on-lan
> package when I try to access the server from anywhere.
>
> Now the server should also suspend again after like 5 minutes after
>
> - last disk activity
> - last network activity
> - and last considerable CPU load
>
> Can systemd solve this?
Well, yes and no.
We have idle detection in logind, and the system can be suspended or
powered down automatically on idle. However, that idle logic is built
around user interactive and idle locks.
What we do not do is black magic stuff where we "guess" whether it
might be OK to shutdown the machine due to some secondary indicators
such as disk/network/cpu activity. And I am really not convinced that
that's a good idea... Not a fan of heuristics I must say...
The proper way to handle this would be to make daemons take idle locks
whenever they are not idle. But I don't think it will be easy to
convince a lot of daemons of this logic...
Another option might be to extend systemd to allow marking certain
services as implying an idle lock as long as they are running, and
then teaching them exit-on-idle. But this would still require
patching, to make them exit-on-idle. And getting this all into place
in a race-free fashion is particualrly hard...
Or the really short summary: if you want something quickly, then this
needs to be done outside of the systemd context...
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list