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"
26 xmlns:xi="http://www.w3.org/2001/XInclude">
29 <title>systemd-suspend.service</title>
30 <productname>systemd</productname>
34 <contrib>Developer</contrib>
35 <firstname>Lennart</firstname>
36 <surname>Poettering</surname>
37 <email>lennart@poettering.net</email>
43 <refentrytitle>systemd-suspend.service</refentrytitle>
44 <manvolnum>8</manvolnum>
48 <refname>systemd-suspend.service</refname>
49 <refname>systemd-hibernate.service</refname>
50 <refname>systemd-hybrid-sleep.service</refname>
51 <refname>systemd-sleep</refname>
52 <refpurpose>System sleep state logic</refpurpose>
56 <para><filename>systemd-suspend.service</filename></para>
57 <para><filename>systemd-hibernate.service</filename></para>
58 <para><filename>systemd-hybrid-sleep.service</filename></para>
59 <para><filename>/usr/lib/systemd/system-sleep</filename></para>
63 <title>Description</title>
65 <para><filename>systemd-suspend.service</filename> is
66 a system service that is pulled in by
67 <filename>suspend.target</filename> and is responsible
68 for the actual system suspend. Similarly,
69 <filename>systemd-hibernate.service</filename> is
70 pulled in by <filename>hibernate.target</filename> to
71 execute the actual hibernation. Finally,
72 <filename>systemd-hybrid-sleep.service</filename> is
73 pulled in by <filename>hybrid-sleep.target</filename>
74 to execute hybrid hibernation with system
77 <para>Immediately before entering system suspend
79 <filename>systemd-suspend.service</filename> (and the
80 other mentioned units, respectively) will run all
82 <filename>/usr/lib/systemd/system-sleep/</filename>
83 and pass two arguments to them. The first argument
84 will be <literal>pre</literal>, the second either
85 <literal>suspend</literal>,
86 <literal>hibernate</literal>, or
87 <literal>hybrid-sleep</literal> depending on the
88 chosen action. Immediately after leaving system
89 suspend and/or hibernation the same executables are run,
90 but the first argument is now
91 <literal>post</literal>. All executables in this
92 directory are executed in parallel, and execution of
93 the action is not continued until all executables
96 <para>Note that scripts or binaries dropped in
97 <filename>/usr/lib/systemd/system-sleep/</filename>
98 are intended for local use only and should be
99 considered hacks. If applications want to be notified
100 of system suspend/hibernation and resume, there are
101 much nicer interfaces available.</para>
104 <filename>systemd-suspend.service</filename>,
105 <filename>systemd-hibernate.service</filename>, and
106 <filename>systemd-hybrid-sleep.service</filename>
107 should never be executed directly. Instead, trigger
108 system sleep states with a command such as
109 <literal>systemctl suspend</literal> or
112 <para>Internally, this service will echo a string like
113 <literal>mem</literal> into
114 <filename>/sys/power/state</filename>, to trigger the
115 actual system suspend. What exactly is written
116 where can be configured in the <literal>[Sleep]</literal>
117 section of <filename>/etc/systemd/sleep.conf</filename> or a
118 <filename>sleep.conf.d</filename> file.
119 See <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
124 <title>Options</title>
126 <para><command>systemd-sleep</command> understands the
127 following commands:</para>
130 <xi:include href="standard-options.xml" xpointer="help" />
131 <xi:include href="standard-options.xml" xpointer="version" />
134 <term><option>suspend</option></term>
135 <term><option>hibernate</option></term>
136 <term><option>hybrid-sleep</option></term>
138 <listitem><para>Suspend, hibernate, or
139 put the system to hybrid sleep.</para>
146 <title>See Also</title>
148 <citerefentry><refentrytitle>systemd-sleep.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
149 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
150 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
151 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
152 <citerefentry><refentrytitle>systemd-halt.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>