1

systemd-suspend.service man page:

Note that scripts or binaries dropped in /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.

So what are some of these "nicer interfaces" that I can use to get notified before suspension? (would be nice if it is before n sec/min)

mockingjay
  • 11
  • 1
  • I'm not sure which ones they're referring to, but http://www.freedesktop.org/wiki/Software/systemd/inhibit is one of them... – derobert May 01 '17 at 21:55

1 Answers1

0

"Nicer interfaces" is probably referring to the Inhibitor Locks implemented in systemd-logind.service, which includes a logic to inhibit system shutdowns and sleep states.

From man systemd-logind.service:

DESCRIPTION

systemd-logind is a system service that manages user logins. It is responsible for:

  • ...
  • Implementing a shutdown/sleep inhibition logic for applications

...

For more information on the inhibition logic see the Inhibitor Lock Developer Documentation.

Another solution that I can think of is to write a systemd service, see https://www.freedesktop.org/software/systemd/man/systemd.unit.html and this related question for example.

resc
  • 1,214
  • 10
  • 19