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