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