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