]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-inhibit.xml
verify: use manager_load_startable_unit_or_warn() to load units for verification
[thirdparty/systemd.git] / man / systemd-inhibit.xml
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
5 <!--
6 SPDX-License-Identifier: LGPL-2.1+
7
8 This file is part of systemd.
9
10 Copyright 2012 Lennart Poettering
11
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
16
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 -->
25
26 <refentry id="systemd-inhibit"
27 xmlns:xi="http://www.w3.org/2001/XInclude">
28
29 <refentryinfo>
30 <title>systemd-inhibit</title>
31 <productname>systemd</productname>
32
33 <authorgroup>
34 <author>
35 <contrib>Developer</contrib>
36 <firstname>Lennart</firstname>
37 <surname>Poettering</surname>
38 <email>lennart@poettering.net</email>
39 </author>
40 </authorgroup>
41 </refentryinfo>
42
43 <refmeta>
44 <refentrytitle>systemd-inhibit</refentrytitle>
45 <manvolnum>1</manvolnum>
46 </refmeta>
47
48 <refnamediv>
49 <refname>systemd-inhibit</refname>
50 <refpurpose>Execute a program with an inhibition lock taken</refpurpose>
51 </refnamediv>
52
53 <refsynopsisdiv>
54 <cmdsynopsis>
55 <command>systemd-inhibit <arg choice="opt" rep="repeat">OPTIONS</arg> <arg>COMMAND</arg> <arg choice="opt" rep="repeat">ARGUMENTS</arg></command>
56 </cmdsynopsis>
57 <cmdsynopsis>
58 <command>systemd-inhibit <arg choice="opt" rep="repeat">OPTIONS</arg> --list</command>
59 </cmdsynopsis>
60 </refsynopsisdiv>
61
62 <refsect1>
63 <title>Description</title>
64
65 <para><command>systemd-inhibit</command> may be used to execute a
66 program with a shutdown, sleep, or idle inhibitor lock taken. The
67 lock will be acquired before the specified command line is
68 executed and released afterwards.</para>
69
70 <para>Inhibitor locks may be used to block or delay system sleep
71 and shutdown requests from the user, as well as automatic idle
72 handling of the OS. This is useful to avoid system suspends while
73 an optical disc is being recorded, or similar operations that
74 should not be interrupted.</para>
75
76 <para>For more information see the <ulink
77 url="https://www.freedesktop.org/wiki/Software/systemd/inhibit">Inhibitor
78 Lock Developer Documentation</ulink>.</para>
79 </refsect1>
80
81 <refsect1>
82 <title>Options</title>
83
84 <para>The following options are understood:</para>
85
86 <variablelist>
87 <varlistentry>
88 <term><option>--what=</option></term>
89
90 <listitem><para>Takes a colon-separated list of one or more
91 operations to inhibit:
92 <literal>shutdown</literal>,
93 <literal>sleep</literal>,
94 <literal>idle</literal>,
95 <literal>handle-power-key</literal>,
96 <literal>handle-suspend-key</literal>,
97 <literal>handle-hibernate-key</literal>,
98 <literal>handle-lid-switch</literal>,
99 for inhibiting reboot/power-off/halt/kexec,
100 suspending/hibernating, the automatic idle detection, or the
101 low-level handling of the power/sleep key and the lid switch,
102 respectively. If omitted, defaults to
103 <literal>idle:sleep:shutdown</literal>.</para></listitem>
104 </varlistentry>
105
106 <varlistentry>
107 <term><option>--who=</option></term>
108
109 <listitem><para>Takes a short, human-readable descriptive
110 string for the program taking the lock. If not passed,
111 defaults to the command line string.</para></listitem>
112 </varlistentry>
113
114 <varlistentry>
115 <term><option>--why=</option></term>
116
117 <listitem><para>Takes a short, human-readable descriptive
118 string for the reason for taking the lock. Defaults to
119 "Unknown reason".</para></listitem>
120 </varlistentry>
121
122 <varlistentry>
123 <term><option>--mode=</option></term>
124
125 <listitem><para>Takes either <literal>block</literal> or
126 <literal>delay</literal> and describes how the lock is
127 applied. If <literal>block</literal> is used (the default),
128 the lock prohibits any of the requested operations without
129 time limit, and only privileged users may override it. If
130 <literal>delay</literal> is used, the lock can only delay the
131 requested operations for a limited time. If the time elapses,
132 the lock is ignored and the operation executed. The time limit
133 may be specified in
134 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
135 Note that <literal>delay</literal> is only available for
136 <literal>sleep</literal> and
137 <literal>shutdown</literal>.</para></listitem>
138 </varlistentry>
139
140 <varlistentry>
141 <term><option>--list</option></term>
142
143 <listitem><para>Lists all active inhibition locks instead of
144 acquiring one.</para></listitem>
145 </varlistentry>
146
147 <xi:include href="standard-options.xml" xpointer="help" />
148 <xi:include href="standard-options.xml" xpointer="version" />
149 </variablelist>
150
151 </refsect1>
152
153 <refsect1>
154 <title>Exit status</title>
155
156 <para>Returns the exit status of the executed program.</para>
157 </refsect1>
158
159 <refsect1>
160 <title>Example</title>
161
162 <programlisting># systemd-inhibit wodim foobar.iso</programlisting>
163
164 <para>This burns the ISO image
165 <filename>foobar.iso</filename> on a CD using
166 <citerefentry project='man-pages'><refentrytitle>wodim</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
167 and inhibits system sleeping, shutdown and idle while
168 doing so.</para>
169 </refsect1>
170
171 <refsect1>
172 <title>See Also</title>
173 <para>
174 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
175 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
176 </para>
177 </refsect1>
178
179 </refentry>