]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-suspend.service.xml
man: use same version in public and system ident.
[thirdparty/systemd.git] / man / systemd-suspend.service.xml
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.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="systemd-suspend.service"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>systemd-suspend.service</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>systemd-suspend.service</refentrytitle>
16 <manvolnum>8</manvolnum>
17 </refmeta>
18
19 <refnamediv>
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>
26 </refnamediv>
27
28 <refsynopsisdiv>
29 <para><simplelist>
30 <member><filename>systemd-suspend.service</filename></member>
31 <member><filename>systemd-hibernate.service</filename></member>
32 <member><filename>systemd-hybrid-sleep.service</filename></member>
33 <member><filename>systemd-suspend-then-hibernate.service</filename></member>
34 <member><filename>/usr/lib/systemd/system-sleep</filename></member>
35 </simplelist></para>
36 </refsynopsisdiv>
37
38 <refsect1>
39 <title>Description</title>
40
41 <para><filename>systemd-suspend.service</filename> is a system
42 service that is pulled in by <filename>suspend.target</filename>
43 and is responsible for the actual system suspend. Similarly,
44 <filename>systemd-hibernate.service</filename> is pulled in by
45 <filename>hibernate.target</filename> to execute the actual
46 hibernation. Finally,
47 <filename>systemd-hybrid-sleep.service</filename> is pulled in by
48 <filename>hybrid-sleep.target</filename> to execute hybrid
49 hibernation with system suspend and pulled in by
50 <filename>suspend-then-hibernate.target</filename> to execute system suspend
51 with a timeout that will activate hibernate later.</para>
52
53 <para>Immediately before entering system suspend and/or
54 hibernation <filename>systemd-suspend.service</filename> (and the
55 other mentioned units, respectively) will run all executables in
56 <filename>/usr/lib/systemd/system-sleep/</filename> and pass two
57 arguments to them. The first argument will be
58 <literal>pre</literal>, the second either
59 <literal>suspend</literal>, <literal>hibernate</literal>,
60 <literal>hybrid-sleep</literal>, or <literal>suspend-then-hibernate</literal>
61 depending on the chosen action. An environment variable called <literal>SYSTEMD_SLEEP_ACTION</literal>
62 will be set and contain the sleep action that is processing. This is primarily helpful for
63 <literal>suspend-then-hibernate</literal> where the value of the variable will be <literal>suspend</literal>, <literal>hibernate</literal>,
64 or <literal>suspend-after-failed-hibernate</literal> in cases where hibernation has failed.
65 Immediately after leaving system suspend and/or hibernation the
66 same executables are run, but the first argument is now
67 <literal>post</literal>. All executables in this directory are
68 executed in parallel, and execution of the action is not continued
69 until all executables have finished.</para>
70
71 <para>Note that scripts or binaries dropped in
72 <filename>/usr/lib/systemd/system-sleep/</filename> are intended
73 for local use only and should be considered hacks. If applications
74 want to react to system suspend/hibernation and resume,
75 they should rather use the <ulink
76 url="https://www.freedesktop.org/wiki/Software/systemd/inhibit">Inhibitor
77 interface</ulink>.</para>
78
79 <para>Note that <filename>systemd-suspend.service</filename>,
80 <filename>systemd-hibernate.service</filename>, <filename>systemd-hybrid-sleep.service</filename>, and
81 <filename>systemd-suspend-then-hibernate.service</filename> should never be executed directly. Instead,
82 trigger system sleep with a command such as <command>systemctl suspend</command> or <command>systemctl
83 hibernate</command>.</para>
84
85 <para>Internally, this service will echo a string like
86 <literal>mem</literal> into <filename>/sys/power/state</filename>,
87 to trigger the actual system suspend. What exactly is written
88 where can be configured in the [Sleep] section
89 of <filename>/etc/systemd/sleep.conf</filename> or a
90 <filename>sleep.conf.d</filename> file. See
91 <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
92 </para>
93 </refsect1>
94
95 <refsect1>
96 <title>Options</title>
97
98 <para><command>systemd-sleep</command> understands the
99 following commands:</para>
100
101 <variablelist>
102 <xi:include href="standard-options.xml" xpointer="help" />
103 <xi:include href="standard-options.xml" xpointer="version" />
104
105 <varlistentry>
106 <term><option>suspend</option></term>
107 <term><option>hibernate</option></term>
108 <term><option>suspend-then-hibernate</option></term>
109 <term><option>hybrid-sleep</option></term>
110
111 <listitem><para>Suspend, hibernate, suspend then hibernate, or put the
112 system to hybrid sleep.</para>
113
114 <xi:include href="version-info.xml" xpointer="v203"/>
115 </listitem>
116 </varlistentry>
117 </variablelist>
118 </refsect1>
119
120 <refsect1>
121 <title>See Also</title>
122 <para><simplelist type="inline">
123 <member><citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
124 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
125 <member><citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
126 <member><citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
127 <member><citerefentry><refentrytitle>systemd-halt.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
128 </simplelist></para>
129 </refsect1>
130
131 </refentry>