]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-suspend.service.xml
Merge pull request #30284 from YHNdnzj/fstab-wantedby-defaultdeps
[thirdparty/systemd.git] / man / systemd-suspend.service.xml
CommitLineData
e2b696ee 1<?xml version='1.0'?> <!--*-nxml-*-->
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
e2b696ee 5
dfdebb1b 6<refentry id="systemd-suspend.service"
798d3a52
ZJS
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>systemd-suspend.service</title>
11 <productname>systemd</productname>
798d3a52
ZJS
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>
e68c79db 23 <refname>systemd-suspend-then-hibernate.service</refname>
798d3a52
ZJS
24 <refname>systemd-sleep</refname>
25 <refpurpose>System sleep state logic</refpurpose>
26 </refnamediv>
27
28 <refsynopsisdiv>
73e97bb0
ZJS
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>
798d3a52
ZJS
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
c58493c0 49 hibernation with system suspend and pulled in by
e68c79db 50 <filename>suspend-then-hibernate.target</filename> to execute system suspend
c58493c0 51 with a timeout that will activate hibernate later.</para>
798d3a52
ZJS
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
12b42c76 56 <filename>/usr/lib/systemd/system-sleep/</filename> and pass two
798d3a52
ZJS
57 arguments to them. The first argument will be
58 <literal>pre</literal>, the second either
c58493c0 59 <literal>suspend</literal>, <literal>hibernate</literal>,
e68c79db 60 <literal>hybrid-sleep</literal>, or <literal>suspend-then-hibernate</literal>
ae463e4e
ZS
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.
798d3a52
ZJS
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
12b42c76 72 <filename>/usr/lib/systemd/system-sleep/</filename> are intended
798d3a52 73 for local use only and should be considered hacks. If applications
63927b9f
MP
74 want to react to system suspend/hibernation and resume,
75 they should rather use the <ulink
28a0ad81 76 url="https://www.freedesktop.org/wiki/Software/systemd/inhibit">Inhibitor
63927b9f 77 interface</ulink>.</para>
798d3a52 78
e9dd6984
ZJS
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>
798d3a52
ZJS
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
bdac5608 88 where can be configured in the [Sleep] section
12b42c76 89 of <filename>/etc/systemd/sleep.conf</filename> or a
798d3a52
ZJS
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>
e68c79db 108 <term><option>suspend-then-hibernate</option></term>
33f899bd 109 <term><option>hybrid-sleep</option></term>
798d3a52 110
e68c79db 111 <listitem><para>Suspend, hibernate, suspend then hibernate, or put the
c58493c0 112 system to hybrid sleep.</para>
aefdc112
AK
113
114 <xi:include href="version-info.xml" xpointer="v203"/>
798d3a52
ZJS
115 </listitem>
116 </varlistentry>
117 </variablelist>
118 </refsect1>
119
120 <refsect1>
121 <title>See Also</title>
122 <para>
123 <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
124 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
125 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
126 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
127 <citerefentry><refentrytitle>systemd-halt.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
128 </para>
129 </refsect1>
e2b696ee
LP
130
131</refentry>