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