]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-suspend.service.xml
verify: use manager_load_startable_unit_or_warn() to load units for verification
[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 This file is part of systemd.
9
10 Copyright 2012 Lennart Poettering
11 Copyright 2013 Zbigniew Jędrzejewski-Szmek
12
13 systemd is free software; you can redistribute it and/or modify it
14 under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation; either version 2.1 of the License, or
16 (at your option) any later version.
17
18 systemd is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public License
24 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 -->
26
27 <refentry id="systemd-suspend.service"
28 xmlns:xi="http://www.w3.org/2001/XInclude">
29
30 <refentryinfo>
31 <title>systemd-suspend.service</title>
32 <productname>systemd</productname>
33
34 <authorgroup>
35 <author>
36 <contrib>Developer</contrib>
37 <firstname>Lennart</firstname>
38 <surname>Poettering</surname>
39 <email>lennart@poettering.net</email>
40 </author>
41 </authorgroup>
42 </refentryinfo>
43
44 <refmeta>
45 <refentrytitle>systemd-suspend.service</refentrytitle>
46 <manvolnum>8</manvolnum>
47 </refmeta>
48
49 <refnamediv>
50 <refname>systemd-suspend.service</refname>
51 <refname>systemd-hibernate.service</refname>
52 <refname>systemd-hybrid-sleep.service</refname>
53 <refname>systemd-suspend-then-hibernate.service</refname>
54 <refname>systemd-sleep</refname>
55 <refpurpose>System sleep state logic</refpurpose>
56 </refnamediv>
57
58 <refsynopsisdiv>
59 <para><filename>systemd-suspend.service</filename></para>
60 <para><filename>systemd-hibernate.service</filename></para>
61 <para><filename>systemd-hybrid-sleep.service</filename></para>
62 <para><filename>systemd-suspend-then-hibernate.service</filename></para>
63 <para><filename>/usr/lib/systemd/system-sleep</filename></para>
64 </refsynopsisdiv>
65
66 <refsect1>
67 <title>Description</title>
68
69 <para><filename>systemd-suspend.service</filename> is a system
70 service that is pulled in by <filename>suspend.target</filename>
71 and is responsible for the actual system suspend. Similarly,
72 <filename>systemd-hibernate.service</filename> is pulled in by
73 <filename>hibernate.target</filename> to execute the actual
74 hibernation. Finally,
75 <filename>systemd-hybrid-sleep.service</filename> is pulled in by
76 <filename>hybrid-sleep.target</filename> to execute hybrid
77 hibernation with system suspend and pulled in by
78 <filename>suspend-then-hibernate.target</filename> to execute system suspend
79 with a timeout that will activate hibernate later.</para>
80
81 <para>Immediately before entering system suspend and/or
82 hibernation <filename>systemd-suspend.service</filename> (and the
83 other mentioned units, respectively) will run all executables in
84 <filename>/usr/lib/systemd/system-sleep/</filename> and pass two
85 arguments to them. The first argument will be
86 <literal>pre</literal>, the second either
87 <literal>suspend</literal>, <literal>hibernate</literal>,
88 <literal>hybrid-sleep</literal>, or <literal>suspend-then-hibernate</literal>
89 depending on the chosen action.
90 Immediately after leaving system suspend and/or hibernation the
91 same executables are run, but the first argument is now
92 <literal>post</literal>. All executables in this directory are
93 executed in parallel, and execution of the action is not continued
94 until all executables have finished.</para>
95
96 <para>Note that scripts or binaries dropped in
97 <filename>/usr/lib/systemd/system-sleep/</filename> are intended
98 for local use only and should be considered hacks. If applications
99 want to react to system suspend/hibernation and resume,
100 they should rather use the <ulink
101 url="https://www.freedesktop.org/wiki/Software/systemd/inhibit">Inhibitor
102 interface</ulink>.</para>
103
104 <para>Note that
105 <filename>systemd-suspend.service</filename>,
106 <filename>systemd-hibernate.service</filename>, and
107 <filename>systemd-hybrid-sleep.service</filename>
108 <filename>systemd-suspend-then-hibernate.service</filename>
109 should never be executed directly. Instead, trigger system sleep
110 states with a command such as <literal>systemctl suspend</literal>
111 or similar.</para>
112
113 <para>Internally, this service will echo a string like
114 <literal>mem</literal> into <filename>/sys/power/state</filename>,
115 to trigger the actual system suspend. What exactly is written
116 where can be configured in the <literal>[Sleep]</literal> section
117 of <filename>/etc/systemd/sleep.conf</filename> or a
118 <filename>sleep.conf.d</filename> file. See
119 <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
120 </para>
121 </refsect1>
122
123 <refsect1>
124 <title>Options</title>
125
126 <para><command>systemd-sleep</command> understands the
127 following commands:</para>
128
129 <variablelist>
130 <xi:include href="standard-options.xml" xpointer="help" />
131 <xi:include href="standard-options.xml" xpointer="version" />
132
133 <varlistentry>
134 <term><option>suspend</option></term>
135 <term><option>hibernate</option></term>
136 <term><option>hybrid-sleep</option></term>
137 <term><option>suspend-then-hibernate</option></term>
138
139 <listitem><para>Suspend, hibernate, suspend then hibernate, or put the
140 system to hybrid sleep.</para>
141 </listitem>
142 </varlistentry>
143 </variablelist>
144 </refsect1>
145
146 <refsect1>
147 <title>See Also</title>
148 <para>
149 <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
150 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
151 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
152 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
153 <citerefentry><refentrytitle>systemd-halt.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
154 </para>
155 </refsect1>
156
157 </refentry>