[systemd-devel] suspend/resume hooks, the right way
Lennart Poettering
lennart at poettering.net
Sat Sep 26 04:06:53 PDT 2015
On Fri, 25.09.15 22:17, Ćukasz Stelmach (stlman at poczta.fm) wrote:
> Hi,
>
> systemd-sleep(8) states
>
> Note that scripts or binaries dropped in /usr/lib/systemd/system-sleep/
> are intended for local use only and should be considered hacks. If
> applications want to be notified of system suspend/hibernation and
> resume, there are much nicer interfaces available.
>
> What is the right way to hook some oneshot services like battery status
> monitor[1] into systemd so they get executed as pre-sleep and
> post-resume (or more specifically (pre|post)-(suspend|hibernate|hybrid-sleep)
> if possible) hooks?
Applications should use suspend delay inhibitors in logind so that
they get a certain amount of time to whatever they want to do before
the system goes to sleep.
https://wiki.freedesktop.org/www/Software/systemd/inhibit/
> Then, does any part of systemd (package) react to plugging and
> unplugging DC jack into a laptop?
I think you get an uevent for this, hence you could do it via udev
rules, no?
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list