]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-suspend.service.xml
test-hostname-util: add assert_se's to make coverity happy
[thirdparty/systemd.git] / man / systemd-suspend.service.xml
CommitLineData
e2b696ee
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
e2b696ee
LP
4
5<!--
572eb058
ZJS
6 SPDX-License-Identifier: LGPL-2.1+
7
e2b696ee
LP
8 This file is part of systemd.
9
10 Copyright 2012 Lennart Poettering
19adb8a3 11 Copyright 2013 Zbigniew Jędrzejewski-Szmek
e2b696ee
LP
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
dfdebb1b 27<refentry id="systemd-suspend.service"
798d3a52
ZJS
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-sleep</refname>
54 <refpurpose>System sleep state logic</refpurpose>
55 </refnamediv>
56
57 <refsynopsisdiv>
58 <para><filename>systemd-suspend.service</filename></para>
59 <para><filename>systemd-hibernate.service</filename></para>
60 <para><filename>systemd-hybrid-sleep.service</filename></para>
12b42c76 61 <para><filename>/usr/lib/systemd/system-sleep</filename></para>
798d3a52
ZJS
62 </refsynopsisdiv>
63
64 <refsect1>
65 <title>Description</title>
66
67 <para><filename>systemd-suspend.service</filename> is a system
68 service that is pulled in by <filename>suspend.target</filename>
69 and is responsible for the actual system suspend. Similarly,
70 <filename>systemd-hibernate.service</filename> is pulled in by
71 <filename>hibernate.target</filename> to execute the actual
72 hibernation. Finally,
73 <filename>systemd-hybrid-sleep.service</filename> is pulled in by
74 <filename>hybrid-sleep.target</filename> to execute hybrid
75 hibernation with system suspend.</para>
76
77 <para>Immediately before entering system suspend and/or
78 hibernation <filename>systemd-suspend.service</filename> (and the
79 other mentioned units, respectively) will run all executables in
12b42c76 80 <filename>/usr/lib/systemd/system-sleep/</filename> and pass two
798d3a52
ZJS
81 arguments to them. The first argument will be
82 <literal>pre</literal>, the second either
83 <literal>suspend</literal>, <literal>hibernate</literal>, or
84 <literal>hybrid-sleep</literal> depending on the chosen action.
85 Immediately after leaving system suspend and/or hibernation the
86 same executables are run, but the first argument is now
87 <literal>post</literal>. All executables in this directory are
88 executed in parallel, and execution of the action is not continued
89 until all executables have finished.</para>
90
91 <para>Note that scripts or binaries dropped in
12b42c76 92 <filename>/usr/lib/systemd/system-sleep/</filename> are intended
798d3a52 93 for local use only and should be considered hacks. If applications
63927b9f
MP
94 want to react to system suspend/hibernation and resume,
95 they should rather use the <ulink
28a0ad81 96 url="https://www.freedesktop.org/wiki/Software/systemd/inhibit">Inhibitor
63927b9f 97 interface</ulink>.</para>
798d3a52
ZJS
98
99 <para>Note that
100 <filename>systemd-suspend.service</filename>,
101 <filename>systemd-hibernate.service</filename>, and
102 <filename>systemd-hybrid-sleep.service</filename>
103 should never be executed directly. Instead, trigger system sleep
104 states with a command such as <literal>systemctl suspend</literal>
105 or similar.</para>
106
107 <para>Internally, this service will echo a string like
108 <literal>mem</literal> into <filename>/sys/power/state</filename>,
109 to trigger the actual system suspend. What exactly is written
110 where can be configured in the <literal>[Sleep]</literal> section
12b42c76 111 of <filename>/etc/systemd/sleep.conf</filename> or a
798d3a52
ZJS
112 <filename>sleep.conf.d</filename> file. See
113 <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
114 </para>
115 </refsect1>
116
117 <refsect1>
118 <title>Options</title>
119
120 <para><command>systemd-sleep</command> understands the
121 following commands:</para>
122
123 <variablelist>
124 <xi:include href="standard-options.xml" xpointer="help" />
125 <xi:include href="standard-options.xml" xpointer="version" />
126
127 <varlistentry>
128 <term><option>suspend</option></term>
129 <term><option>hibernate</option></term>
130 <term><option>hybrid-sleep</option></term>
131
132 <listitem><para>Suspend, hibernate, or put the system to
133 hybrid sleep.</para>
134 </listitem>
135 </varlistentry>
136 </variablelist>
137 </refsect1>
138
139 <refsect1>
140 <title>See Also</title>
141 <para>
142 <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
143 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
144 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
145 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
146 <citerefentry><refentrytitle>systemd-halt.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
147 </para>
148 </refsect1>
e2b696ee
LP
149
150</refentry>