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