| 1 |
'\" t |
| 2 |
.TH "SYSTEMD\-SUSPEND\&.SERVICE" "8" "" "systemd 261~rc3" "systemd-suspend.service" |
| 3 |
.\" ----------------------------------------------------------------- |
| 4 |
.\" * Define some portability stuff |
| 5 |
.\" ----------------------------------------------------------------- |
| 6 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 7 |
.\" http://bugs.debian.org/507673 |
| 8 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 9 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 10 |
.ie \n(.g .ds Aq \(aq |
| 11 |
.el .ds Aq ' |
| 12 |
.\" ----------------------------------------------------------------- |
| 13 |
.\" * set default formatting |
| 14 |
.\" ----------------------------------------------------------------- |
| 15 |
.\" disable hyphenation |
| 16 |
.nh |
| 17 |
.\" disable justification (adjust text to left margin only) |
| 18 |
.ad l |
| 19 |
.\" ----------------------------------------------------------------- |
| 20 |
.\" * MAIN CONTENT STARTS HERE * |
| 21 |
.\" ----------------------------------------------------------------- |
| 22 |
.SH "NAME" |
| 23 |
systemd-suspend.service, systemd-hibernate.service, systemd-hybrid-sleep.service, systemd-suspend-then-hibernate.service, systemd-sleep \- System sleep state logic |
| 24 |
.SH "SYNOPSIS" |
| 25 |
.PP |
| 26 |
.RS 4 |
| 27 |
systemd\-suspend\&.service |
| 28 |
.RE |
| 29 |
.RS 4 |
| 30 |
systemd\-hibernate\&.service |
| 31 |
.RE |
| 32 |
.RS 4 |
| 33 |
systemd\-hybrid\-sleep\&.service |
| 34 |
.RE |
| 35 |
.RS 4 |
| 36 |
systemd\-suspend\-then\-hibernate\&.service |
| 37 |
.RE |
| 38 |
.RS 4 |
| 39 |
/usr/lib/systemd/system\-sleep |
| 40 |
.RE |
| 41 |
.SH "DESCRIPTION" |
| 42 |
.PP |
| 43 |
systemd\-suspend\&.service |
| 44 |
is a system service that is pulled in by |
| 45 |
suspend\&.target |
| 46 |
and is responsible for the actual system suspend\&. Similarly, |
| 47 |
systemd\-hibernate\&.service |
| 48 |
is pulled in by |
| 49 |
hibernate\&.target |
| 50 |
to execute the actual hibernation\&. Finally, |
| 51 |
systemd\-hybrid\-sleep\&.service |
| 52 |
is pulled in by |
| 53 |
hybrid\-sleep\&.target |
| 54 |
to execute hybrid hibernation with system suspend and pulled in by |
| 55 |
suspend\-then\-hibernate\&.target |
| 56 |
to execute system suspend with a timeout that will activate hibernate later\&. |
| 57 |
.PP |
| 58 |
Immediately before entering system suspend and/or hibernation |
| 59 |
systemd\-suspend\&.service |
| 60 |
(and the other mentioned units, respectively) will run all executables in |
| 61 |
/usr/lib/systemd/system\-sleep/ |
| 62 |
and pass two arguments to them\&. The first argument will be |
| 63 |
"pre", the second either |
| 64 |
"suspend", |
| 65 |
"hibernate", |
| 66 |
"hybrid\-sleep", or |
| 67 |
"suspend\-then\-hibernate" |
| 68 |
depending on the chosen action\&. An environment variable called |
| 69 |
"SYSTEMD_SLEEP_ACTION" |
| 70 |
will be set and contain the sleep action that is processing\&. This is primarily helpful for |
| 71 |
"suspend\-then\-hibernate" |
| 72 |
where the value of the variable will be |
| 73 |
"suspend", |
| 74 |
"hibernate", or |
| 75 |
"suspend\-after\-failed\-hibernate" |
| 76 |
in cases where hibernation has failed\&. Immediately after leaving system suspend and/or hibernation the same executables are run, but the first argument is now |
| 77 |
"post"\&. All executables in this directory are executed in parallel, and execution of the action is not continued until all executables have finished\&. Note that |
| 78 |
user\&.slice |
| 79 |
will be frozen while the executables are running, so they should not attempt to communicate with any user services expecting a reply\&. |
| 80 |
.PP |
| 81 |
Note that scripts or binaries dropped in |
| 82 |
/usr/lib/systemd/system\-sleep/ |
| 83 |
are intended for local use only and should be considered hacks\&. If applications want to react to system suspend/hibernation and resume, they should rather use the |
| 84 |
\m[blue]\fBInhibitor Locks\fR\m[]\&\s-2\u[1]\d\s+2\&. |
| 85 |
.PP |
| 86 |
Note that |
| 87 |
systemd\-suspend\&.service, |
| 88 |
systemd\-hibernate\&.service, |
| 89 |
systemd\-hybrid\-sleep\&.service, and |
| 90 |
systemd\-suspend\-then\-hibernate\&.service |
| 91 |
should never be executed directly\&. Instead, trigger system sleep with a command such as |
| 92 |
\fBsystemctl suspend\fR |
| 93 |
or |
| 94 |
\fBsystemctl hibernate\fR\&. |
| 95 |
.PP |
| 96 |
Internally, this service will echo a string like |
| 97 |
"mem" |
| 98 |
into |
| 99 |
/sys/power/state, to trigger the actual system suspend\&. What exactly is written where can be configured in the [Sleep] section of |
| 100 |
/etc/systemd/sleep\&.conf |
| 101 |
or a |
| 102 |
sleep\&.conf\&.d |
| 103 |
file\&. See |
| 104 |
\fBsystemd-sleep.conf\fR(5)\&. |
| 105 |
.PP |
| 106 |
Note that by default these services freeze |
| 107 |
user\&.slice |
| 108 |
while they run\&. This prevents the execution of any process in any of the user sessions while the system is entering into and resuming from sleep\&. Thus, this prevents the hooks in |
| 109 |
/usr/lib/systemd/system\-sleep/, or any other process for that matter, from communicating with any user session process during sleep\&. |
| 110 |
.SH "OPTIONS" |
| 111 |
.PP |
| 112 |
\fBsystemd\-sleep\fR |
| 113 |
understands the following commands: |
| 114 |
.PP |
| 115 |
\fB\-h\fR, \fB\-\-help\fR |
| 116 |
.RS 4 |
| 117 |
Print a short help text and exit\&. |
| 118 |
.RE |
| 119 |
.PP |
| 120 |
\fB\-\-version\fR |
| 121 |
.RS 4 |
| 122 |
Print a short version string and exit\&. |
| 123 |
.RE |
| 124 |
.PP |
| 125 |
\fBsuspend\fR, \fBhibernate\fR, \fBsuspend\-then\-hibernate\fR, \fBhybrid\-sleep\fR |
| 126 |
.RS 4 |
| 127 |
Suspend, hibernate, suspend then hibernate, or put the system to hybrid sleep\&. |
| 128 |
.sp |
| 129 |
Added in version 203\&. |
| 130 |
.RE |
| 131 |
.SH "SEE ALSO" |
| 132 |
.PP |
| 133 |
\fBsystemd-sleep.conf\fR(5), \fBsystemd\fR(1), \fBsystemctl\fR(1), \fBsystemd.special\fR(7), \fBsystemd-halt.service\fR(8) |
| 134 |
.SH "NOTES" |
| 135 |
.IP " 1." 4 |
| 136 |
Inhibitor Locks |
| 137 |
.RS 4 |
| 138 |
\%https://systemd.io/INHIBITOR_LOCKS |
| 139 |
.RE |