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