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