]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-suspend.service.xml
travis: add more ASan options
[thirdparty/systemd.git] / man / systemd-suspend.service.xml
CommitLineData
e2b696ee 1<?xml version='1.0'?> <!--*-nxml-*-->
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
0307f791 4<!-- SPDX-License-Identifier: LGPL-2.1+ -->
e2b696ee 5
dfdebb1b 6<refentry id="systemd-suspend.service"
798d3a52
ZJS
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>systemd-suspend.service</title>
11 <productname>systemd</productname>
798d3a52
ZJS
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>systemd-suspend.service</refentrytitle>
16 <manvolnum>8</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>systemd-suspend.service</refname>
21 <refname>systemd-hibernate.service</refname>
22 <refname>systemd-hybrid-sleep.service</refname>
e68c79db 23 <refname>systemd-suspend-then-hibernate.service</refname>
798d3a52
ZJS
24 <refname>systemd-sleep</refname>
25 <refpurpose>System sleep state logic</refpurpose>
26 </refnamediv>
27
28 <refsynopsisdiv>
29 <para><filename>systemd-suspend.service</filename></para>
30 <para><filename>systemd-hibernate.service</filename></para>
31 <para><filename>systemd-hybrid-sleep.service</filename></para>
e68c79db 32 <para><filename>systemd-suspend-then-hibernate.service</filename></para>
12b42c76 33 <para><filename>/usr/lib/systemd/system-sleep</filename></para>
798d3a52
ZJS
34 </refsynopsisdiv>
35
36 <refsect1>
37 <title>Description</title>
38
39 <para><filename>systemd-suspend.service</filename> is a system
40 service that is pulled in by <filename>suspend.target</filename>
41 and is responsible for the actual system suspend. Similarly,
42 <filename>systemd-hibernate.service</filename> is pulled in by
43 <filename>hibernate.target</filename> to execute the actual
44 hibernation. Finally,
45 <filename>systemd-hybrid-sleep.service</filename> is pulled in by
46 <filename>hybrid-sleep.target</filename> to execute hybrid
c58493c0 47 hibernation with system suspend and pulled in by
e68c79db 48 <filename>suspend-then-hibernate.target</filename> to execute system suspend
c58493c0 49 with a timeout that will activate hibernate later.</para>
798d3a52
ZJS
50
51 <para>Immediately before entering system suspend and/or
52 hibernation <filename>systemd-suspend.service</filename> (and the
53 other mentioned units, respectively) will run all executables in
12b42c76 54 <filename>/usr/lib/systemd/system-sleep/</filename> and pass two
798d3a52
ZJS
55 arguments to them. The first argument will be
56 <literal>pre</literal>, the second either
c58493c0 57 <literal>suspend</literal>, <literal>hibernate</literal>,
e68c79db 58 <literal>hybrid-sleep</literal>, or <literal>suspend-then-hibernate</literal>
c58493c0 59 depending on the chosen action.
798d3a52
ZJS
60 Immediately after leaving system suspend and/or hibernation the
61 same executables are run, but the first argument is now
62 <literal>post</literal>. All executables in this directory are
63 executed in parallel, and execution of the action is not continued
64 until all executables have finished.</para>
65
66 <para>Note that scripts or binaries dropped in
12b42c76 67 <filename>/usr/lib/systemd/system-sleep/</filename> are intended
798d3a52 68 for local use only and should be considered hacks. If applications
63927b9f
MP
69 want to react to system suspend/hibernation and resume,
70 they should rather use the <ulink
28a0ad81 71 url="https://www.freedesktop.org/wiki/Software/systemd/inhibit">Inhibitor
63927b9f 72 interface</ulink>.</para>
798d3a52
ZJS
73
74 <para>Note that
75 <filename>systemd-suspend.service</filename>,
76 <filename>systemd-hibernate.service</filename>, and
77 <filename>systemd-hybrid-sleep.service</filename>
e68c79db 78 <filename>systemd-suspend-then-hibernate.service</filename>
798d3a52
ZJS
79 should never be executed directly. Instead, trigger system sleep
80 states with a command such as <literal>systemctl suspend</literal>
81 or similar.</para>
82
83 <para>Internally, this service will echo a string like
84 <literal>mem</literal> into <filename>/sys/power/state</filename>,
85 to trigger the actual system suspend. What exactly is written
86 where can be configured in the <literal>[Sleep]</literal> section
12b42c76 87 of <filename>/etc/systemd/sleep.conf</filename> or a
798d3a52
ZJS
88 <filename>sleep.conf.d</filename> file. See
89 <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
90 </para>
91 </refsect1>
92
93 <refsect1>
94 <title>Options</title>
95
96 <para><command>systemd-sleep</command> understands the
97 following commands:</para>
98
99 <variablelist>
100 <xi:include href="standard-options.xml" xpointer="help" />
101 <xi:include href="standard-options.xml" xpointer="version" />
102
103 <varlistentry>
104 <term><option>suspend</option></term>
105 <term><option>hibernate</option></term>
106 <term><option>hybrid-sleep</option></term>
e68c79db 107 <term><option>suspend-then-hibernate</option></term>
798d3a52 108
e68c79db 109 <listitem><para>Suspend, hibernate, suspend then hibernate, or put the
c58493c0 110 system to hybrid sleep.</para>
798d3a52
ZJS
111 </listitem>
112 </varlistentry>
113 </variablelist>
114 </refsect1>
115
116 <refsect1>
117 <title>See Also</title>
118 <para>
119 <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
120 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
121 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
122 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
123 <citerefentry><refentrytitle>systemd-halt.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
124 </para>
125 </refsect1>
e2b696ee
LP
126
127</refentry>