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" [
4 <!ENTITY % entities SYSTEM
"custom-entities.ent" >
9 This file is part of systemd.
11 Copyright 2012 Lennart Poettering
12 Copyright 2013 Zbigniew Jędrzejewski-Szmek
14 systemd is free software; you can redistribute it and/or modify it
15 under the terms of the GNU Lesser General Public License as published by
16 the Free Software Foundation; either version 2.1 of the License, or
17 (at your option) any later version.
19 systemd is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 Lesser General Public License for more details.
24 You should have received a copy of the GNU Lesser General Public License
25 along with systemd; If not, see <http://www.gnu.org/licenses/>.
28 <refentry id=
"systemd-suspend.service"
29 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
32 <title>systemd-suspend.service
</title>
33 <productname>systemd
</productname>
37 <contrib>Developer
</contrib>
38 <firstname>Lennart
</firstname>
39 <surname>Poettering
</surname>
40 <email>lennart@poettering.net
</email>
46 <refentrytitle>systemd-suspend.service
</refentrytitle>
47 <manvolnum>8</manvolnum>
51 <refname>systemd-suspend.service
</refname>
52 <refname>systemd-hibernate.service
</refname>
53 <refname>systemd-hybrid-sleep.service
</refname>
54 <refname>systemd-sleep
</refname>
55 <refpurpose>System sleep state logic
</refpurpose>
59 <para><filename>systemd-suspend.service
</filename></para>
60 <para><filename>systemd-hibernate.service
</filename></para>
61 <para><filename>systemd-hybrid-sleep.service
</filename></para>
62 <para><filename>&rootlibexecdir;/system-sleep
</filename></para>
66 <title>Description
</title>
68 <para><filename>systemd-suspend.service
</filename> is a system
69 service that is pulled in by
<filename>suspend.target
</filename>
70 and is responsible for the actual system suspend. Similarly,
71 <filename>systemd-hibernate.service
</filename> is pulled in by
72 <filename>hibernate.target
</filename> to execute the actual
74 <filename>systemd-hybrid-sleep.service
</filename> is pulled in by
75 <filename>hybrid-sleep.target
</filename> to execute hybrid
76 hibernation with system suspend.
</para>
78 <para>Immediately before entering system suspend and/or
79 hibernation
<filename>systemd-suspend.service
</filename> (and the
80 other mentioned units, respectively) will run all executables in
81 <filename>&rootlibexecdir;/system-sleep/
</filename> and pass two
82 arguments to them. The first argument will be
83 <literal>pre
</literal>, the second either
84 <literal>suspend
</literal>,
<literal>hibernate
</literal>, or
85 <literal>hybrid-sleep
</literal> depending on the chosen action.
86 Immediately after leaving system suspend and/or hibernation the
87 same executables are run, but the first argument is now
88 <literal>post
</literal>. All executables in this directory are
89 executed in parallel, and execution of the action is not continued
90 until all executables have finished.
</para>
92 <para>Note that scripts or binaries dropped in
93 <filename>&rootlibexecdir;/system-sleep/
</filename> are intended
94 for local use only and should be considered hacks. If applications
95 want to be notified of system suspend/hibernation and resume,
96 there are much nicer interfaces available.
</para>
99 <filename>systemd-suspend.service
</filename>,
100 <filename>systemd-hibernate.service
</filename>, and
101 <filename>systemd-hybrid-sleep.service
</filename>
102 should never be executed directly. Instead, trigger system sleep
103 states with a command such as
<literal>systemctl suspend
</literal>
106 <para>Internally, this service will echo a string like
107 <literal>mem
</literal> into
<filename>/sys/power/state
</filename>,
108 to trigger the actual system suspend. What exactly is written
109 where can be configured in the
<literal>[Sleep]
</literal> section
110 of
<filename>&pkgsysconfdir;/sleep.conf
</filename> or a
111 <filename>sleep.conf.d
</filename> file. See
112 <citerefentry><refentrytitle>systemd-sleep.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
117 <title>Options
</title>
119 <para><command>systemd-sleep
</command> understands the
120 following commands:
</para>
123 <xi:include href=
"standard-options.xml" xpointer=
"help" />
124 <xi:include href=
"standard-options.xml" xpointer=
"version" />
127 <term><option>suspend
</option></term>
128 <term><option>hibernate
</option></term>
129 <term><option>hybrid-sleep
</option></term>
131 <listitem><para>Suspend, hibernate, or put the system to
139 <title>See Also
</title>
141 <citerefentry><refentrytitle>systemd-sleep.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
142 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
143 <citerefentry><refentrytitle>systemctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
144 <citerefentry><refentrytitle>systemd.special
</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
145 <citerefentry><refentrytitle>systemd-halt.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>