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