1 <?xml version='
1.0'
?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id=
"systemd-suspend.service"
7 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
10 <title>systemd-suspend.service
</title>
11 <productname>systemd
</productname>
15 <refentrytitle>systemd-suspend.service
</refentrytitle>
16 <manvolnum>8</manvolnum>
20 <refname>systemd-suspend.service
</refname>
21 <refname>systemd-hibernate.service
</refname>
22 <refname>systemd-hybrid-sleep.service
</refname>
23 <refname>systemd-suspend-then-hibernate.service
</refname>
24 <refname>systemd-sleep
</refname>
25 <refpurpose>System sleep state logic
</refpurpose>
29 <para><filename>systemd-suspend.service
</filename></para>
30 <para><filename>systemd-hibernate.service
</filename></para>
31 <para><filename>systemd-hybrid-sleep.service
</filename></para>
32 <para><filename>systemd-suspend-then-hibernate.service
</filename></para>
33 <para><filename>/usr/lib/systemd/system-sleep
</filename></para>
37 <title>Description
</title>
39 <para><filename>systemd-suspend.service
</filename> is a system
40 service that is pulled in by
<filename>suspend.target
</filename>
41 and is responsible for the actual system suspend. Similarly,
42 <filename>systemd-hibernate.service
</filename> is pulled in by
43 <filename>hibernate.target
</filename> to execute the actual
45 <filename>systemd-hybrid-sleep.service
</filename> is pulled in by
46 <filename>hybrid-sleep.target
</filename> to execute hybrid
47 hibernation with system suspend and pulled in by
48 <filename>suspend-then-hibernate.target
</filename> to execute system suspend
49 with a timeout that will activate hibernate later.
</para>
51 <para>Immediately before entering system suspend and/or
52 hibernation
<filename>systemd-suspend.service
</filename> (and the
53 other mentioned units, respectively) will run all executables in
54 <filename>/usr/lib/systemd/system-sleep/
</filename> and pass two
55 arguments to them. The first argument will be
56 <literal>pre
</literal>, the second either
57 <literal>suspend
</literal>,
<literal>hibernate
</literal>,
58 <literal>hybrid-sleep
</literal>, or
<literal>suspend-then-hibernate
</literal>
59 depending on the chosen action.
60 Immediately after leaving system suspend and/or hibernation the
61 same executables are run, but the first argument is now
62 <literal>post
</literal>. All executables in this directory are
63 executed in parallel, and execution of the action is not continued
64 until all executables have finished.
</para>
66 <para>Note that scripts or binaries dropped in
67 <filename>/usr/lib/systemd/system-sleep/
</filename> are intended
68 for local use only and should be considered hacks. If applications
69 want to react to system suspend/hibernation and resume,
70 they should rather use the
<ulink
71 url=
"https://www.freedesktop.org/wiki/Software/systemd/inhibit">Inhibitor
72 interface
</ulink>.
</para>
74 <para>Note that
<filename>systemd-suspend.service
</filename>,
75 <filename>systemd-hibernate.service
</filename>,
<filename>systemd-hybrid-sleep.service
</filename>, and
76 <filename>systemd-suspend-then-hibernate.service
</filename> should never be executed directly. Instead,
77 trigger system sleep with a command such as
<command>systemctl suspend
</command> or
<command>systemctl
78 hibernate
</command>.
</para>
80 <para>Internally, this service will echo a string like
81 <literal>mem
</literal> into
<filename>/sys/power/state
</filename>,
82 to trigger the actual system suspend. What exactly is written
83 where can be configured in the [Sleep] section
84 of
<filename>/etc/systemd/sleep.conf
</filename> or a
85 <filename>sleep.conf.d
</filename> file. See
86 <citerefentry><refentrytitle>systemd-sleep.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
91 <title>Options
</title>
93 <para><command>systemd-sleep
</command> understands the
94 following commands:
</para>
97 <xi:include href=
"standard-options.xml" xpointer=
"help" />
98 <xi:include href=
"standard-options.xml" xpointer=
"version" />
101 <term><option>suspend
</option></term>
102 <term><option>hibernate
</option></term>
103 <term><option>hybrid-sleep
</option></term>
104 <term><option>suspend-then-hibernate
</option></term>
106 <listitem><para>Suspend, hibernate, suspend then hibernate, or put the
107 system to hybrid sleep.
</para>
114 <title>See Also
</title>
116 <citerefentry><refentrytitle>systemd-sleep.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
117 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
118 <citerefentry><refentrytitle>systemctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
119 <citerefentry><refentrytitle>systemd.special
</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
120 <citerefentry><refentrytitle>systemd-halt.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>