1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2012 Lennart Poettering
9 Copyright 2013 Zbigniew Jędrzejewski-Szmek
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
14 (at your option) any later version.
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
21 You should have received a copy of the GNU Lesser General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 <refentry id="systemd-suspend.service">
28 <title>systemd-suspend.service</title>
29 <productname>systemd</productname>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
42 <refentrytitle>systemd-suspend.service</refentrytitle>
43 <manvolnum>8</manvolnum>
47 <refname>systemd-suspend.service</refname>
48 <refname>systemd-hibernate.service</refname>
49 <refname>systemd-hybrid-sleep.service</refname>
50 <refname>systemd-sleep</refname>
51 <refpurpose>System sleep state logic</refpurpose>
55 <para><filename>systemd-suspend.service</filename></para>
56 <para><filename>systemd-hibernate.service</filename></para>
57 <para><filename>systemd-hybrid-sleep.service</filename></para>
58 <para><filename>/usr/lib/systemd/systemd-sleep</filename></para>
62 <title>Description</title>
64 <para><filename>systemd-suspend.service</filename> is
65 a system service that is pulled in by
66 <filename>suspend.target</filename> and is responsible
67 for the actual system suspend. Similarly,
68 <filename>systemd-hibernate.service</filename> is
69 pulled in by <filename>hibernate.target</filename> to
70 execute the actual hibernation. Finally,
71 <filename>systemd-hybrid-sleep.service</filename> is
72 pulled in by <filename>hybrid-sleep.target</filename>
73 to execute hybrid hibernation with system
76 <para>Immediately before entering system suspend
78 <filename>systemd-suspend.service</filename> (and the
79 other mentioned units, respectively) will run all
81 <filename>/usr/lib/systemd/system-sleep/</filename>
82 and pass two arguments to them. The first argument
83 will be <literal>pre</literal>, the second either
84 <literal>suspend</literal>,
85 <literal>hibernate</literal>, or
86 <literal>hybrid-sleep</literal> depending on the
87 chosen action. Immediately after leaving system
88 suspend and/or hibernation the same executables are run,
89 but the first argument is now
90 <literal>post</literal>. All executables in this
91 directory are executed in parallel, and execution of
92 the action is not continued until all executables
95 <para>Note that scripts or binaries dropped in
96 <filename>/usr/lib/systemd/system-sleep/</filename>
97 are intended for local use only and should be
98 considered hacks. If applications want to be notified
99 of system suspend/hibernation and resume there are
100 much nicer interfaces available.</para>
103 <filename>systemd-suspend.service</filename>,
104 <filename>systemd-hibernate.service</filename>, and
105 <filename>systemd-hybrid-sleep.service</filename>
106 should never be executed directly. Instead, trigger
107 system sleep states with a command such as
108 <literal>systemctl suspend</literal> or
111 <para>Internally, this service will echo a string like
112 <literal>mem</literal> into
113 <filename>/sys/power/state</filename>, to trigger the
114 actual system suspend. What exactly is written
115 where can be configured in the <literal>[Sleep]</literal>
116 section of <filename>/etc/systemd/sleep.conf</filename>.
117 See <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
122 <title>Options</title>
124 <para><command>systemd-sleep</command> understands the
125 following commands:</para>
129 <term><option>-h</option></term>
130 <term><option>--help</option></term>
132 <listitem><para>Print a short help
133 text and exit.</para></listitem>
136 <term><option>--version</option></term>
138 <listitem><para>Print the systemd version
139 identifier and exit.</para></listitem>
142 <term><option>suspend</option></term>
143 <term><option>hibernate</option></term>
144 <term><option>hybrid-sleep</option></term>
146 <listitem><para>Suspend, hibernate, or
147 put the system to hybrid sleep.</para>
154 <title>See Also</title>
156 <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
157 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
158 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
159 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
160 <citerefentry><refentrytitle>systemd-halt.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>