1SYSTEMD-SUSPEND.SERVICE(8) systemd-suspend.service SYSTEMD-SUSPEND.SERVICE(8)
2
3
4
6 systemd-suspend.service, systemd-hibernate.service, systemd-hybrid-
7 sleep.service, systemd-suspend-then-hibernate.service, systemd-sleep -
8 System sleep state logic
9
11 systemd-suspend.service
12
13 systemd-hibernate.service
14
15 systemd-hybrid-sleep.service
16
17 systemd-suspend-then-hibernate.service
18
19 /usr/lib/systemd/system-sleep
20
22 systemd-suspend.service is a system service that is pulled in by
23 suspend.target and is responsible for the actual system suspend.
24 Similarly, systemd-hibernate.service is pulled in by hibernate.target
25 to execute the actual hibernation. Finally,
26 systemd-hybrid-sleep.service is pulled in by hybrid-sleep.target to
27 execute hybrid hibernation with system suspend and pulled in by
28 suspend-then-hibernate.target to execute system suspend with a timeout
29 that will activate hibernate later.
30
31 Immediately before entering system suspend and/or hibernation
32 systemd-suspend.service (and the other mentioned units, respectively)
33 will run all executables in /usr/lib/systemd/system-sleep/ and pass two
34 arguments to them. The first argument will be "pre", the second either
35 "suspend", "hibernate", "hybrid-sleep", or "suspend-then-hibernate"
36 depending on the chosen action. An environment variable called
37 "SYSTEMD_SLEEP_ACTION" will be set and contain the sleep action that is
38 processing. This is primarily helpful for "suspend-then-hibernate"
39 where the value of the variable will be "suspend", "hibernate", or
40 "suspend-after-failed-hibernate" in cases where hibernation has failed.
41 Immediately after leaving system suspend and/or hibernation the same
42 executables are run, but the first argument is now "post". All
43 executables in this directory are executed in parallel, and execution
44 of the action is not continued until all executables have finished.
45
46 Note that scripts or binaries dropped in /usr/lib/systemd/system-sleep/
47 are intended for local use only and should be considered hacks. If
48 applications want to react to system suspend/hibernation and resume,
49 they should rather use the Inhibitor interface[1].
50
51 Note that systemd-suspend.service, systemd-hibernate.service,
52 systemd-hybrid-sleep.service, and
53 systemd-suspend-then-hibernate.service should never be executed
54 directly. Instead, trigger system sleep with a command such as
55 systemctl suspend or systemctl hibernate.
56
57 Internally, this service will echo a string like "mem" into
58 /sys/power/state, to trigger the actual system suspend. What exactly is
59 written where can be configured in the [Sleep] section of
60 /etc/systemd/sleep.conf or a sleep.conf.d file. See systemd-
61 sleep.conf(5).
62
64 systemd-sleep understands the following commands:
65
66 -h, --help
67 Print a short help text and exit.
68
69 --version
70 Print a short version string and exit.
71
72 suspend, hibernate, suspend-then-hibernate, hybrid-sleep
73 Suspend, hibernate, suspend then hibernate, or put the system to
74 hybrid sleep.
75
77 systemd-sleep.conf(5), systemd(1), systemctl(1), systemd.special(7),
78 systemd-halt.service(8)
79
81 1. Inhibitor interface
82 https://www.freedesktop.org/wiki/Software/systemd/inhibit
83
84
85
86systemd 250 SYSTEMD-SUSPEND.SERVICE(8)