[systemd-devel] suspend hook as user service

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Feb 20 12:20:25 UTC 2017


On Fri, 17 Feb 2017 at 19:41:00 +0100, Michael Hirmke wrote:
> A much better approach is to write a script or program listening for the
> according signals "PrepareForSleep" and "PrepareForShutdown" on the dbus
> interface "org.freedesktop.login1".

This is the thing to do. It allows your program to delay suspend until
it is ready for suspend to happen, or prevent suspend altogether.

For instance, Telepathy delays suspend so it can try to take instant
messaging connections offline first:
https://cgit.freedesktop.org/telepathy/telepathy-mission-control/tree/src/connectivity-monitor.c

    S


More information about the systemd-devel mailing list