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