| 1 |
<?xml version='1.0'?> <!--*-nxml-*--> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="systemd-inhibit" |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>systemd-inhibit</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>systemd-inhibit</refentrytitle> |
| 16 |
<manvolnum>1</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>systemd-inhibit</refname> |
| 21 |
<refpurpose>Execute a program with an inhibition lock taken</refpurpose> |
| 22 |
</refnamediv> |
| 23 |
|
| 24 |
<refsynopsisdiv> |
| 25 |
<cmdsynopsis> |
| 26 |
<command>systemd-inhibit</command> <arg choice="opt" rep="repeat">OPTIONS</arg> <arg>COMMAND</arg> <arg choice="opt" rep="repeat">ARGUMENTS</arg> |
| 27 |
</cmdsynopsis> |
| 28 |
<cmdsynopsis> |
| 29 |
<command>systemd-inhibit</command> <arg choice="opt" rep="repeat">OPTIONS</arg> <arg>--list</arg> |
| 30 |
</cmdsynopsis> |
| 31 |
</refsynopsisdiv> |
| 32 |
|
| 33 |
<refsect1> |
| 34 |
<title>Description</title> |
| 35 |
|
| 36 |
<para><command>systemd-inhibit</command> may be used to execute a |
| 37 |
program with a shutdown, sleep, or idle inhibitor lock taken. The |
| 38 |
lock will be acquired before the specified command line is |
| 39 |
executed and released afterwards.</para> |
| 40 |
|
| 41 |
<para>Inhibitor locks may be used to block or delay system sleep |
| 42 |
and shutdown requests from the user, as well as automatic idle |
| 43 |
handling of the OS. This is useful to avoid system suspends while |
| 44 |
an optical disc is being recorded, or similar operations that |
| 45 |
should not be interrupted.</para> |
| 46 |
|
| 47 |
<para>For more information see |
| 48 |
<ulink url="https://systemd.io/INHIBITOR_LOCKS">Inhibitor Locks</ulink>.</para> |
| 49 |
</refsect1> |
| 50 |
|
| 51 |
<refsect1> |
| 52 |
<title>Options</title> |
| 53 |
|
| 54 |
<para>The following options are understood:</para> |
| 55 |
|
| 56 |
<variablelist> |
| 57 |
<varlistentry> |
| 58 |
<term><option>--what=</option></term> |
| 59 |
|
| 60 |
<listitem><para>Takes a colon-separated list of one or more |
| 61 |
operations to inhibit: |
| 62 |
<literal>shutdown</literal>, |
| 63 |
<literal>sleep</literal>, |
| 64 |
<literal>idle</literal>, |
| 65 |
<literal>handle-power-key</literal>, |
| 66 |
<literal>handle-reboot-key</literal>, |
| 67 |
<literal>handle-suspend-key</literal>, |
| 68 |
<literal>handle-hibernate-key</literal>, |
| 69 |
<literal>handle-lid-switch</literal>, |
| 70 |
for inhibiting reboot/power-off/halt/kexec/soft-reboot, |
| 71 |
suspending/hibernating, the automatic idle detection, or the |
| 72 |
low-level handling of the power/reboot/sleep key and the lid switch, |
| 73 |
respectively. If omitted, defaults to |
| 74 |
<literal>idle:sleep:shutdown</literal>.</para></listitem> |
| 75 |
</varlistentry> |
| 76 |
|
| 77 |
<varlistentry> |
| 78 |
<term><option>--who=</option></term> |
| 79 |
|
| 80 |
<listitem><para>Takes a short, human-readable descriptive |
| 81 |
string for the program taking the lock. If not passed, |
| 82 |
defaults to the command line string.</para></listitem> |
| 83 |
</varlistentry> |
| 84 |
|
| 85 |
<varlistentry> |
| 86 |
<term><option>--why=</option></term> |
| 87 |
|
| 88 |
<listitem><para>Takes a short, human-readable descriptive |
| 89 |
string for the reason for taking the lock. Defaults to |
| 90 |
"Unknown reason".</para></listitem> |
| 91 |
</varlistentry> |
| 92 |
|
| 93 |
<varlistentry> |
| 94 |
<term><option>--mode=</option></term> |
| 95 |
|
| 96 |
<listitem><para>Takes <literal>block</literal>, <literal>delay</literal>, or |
| 97 |
<literal>block-weak</literal> and describes how the lock is applied. If <literal>block</literal> is |
| 98 |
used (the default), the lock prohibits any of the requested operations without time limit, and only |
| 99 |
privileged users may override it. The <literal>block-weak</literal> inhibitor lock type is similar to |
| 100 |
<literal>block</literal> but is not enforced against operations initiated by privileged clients or |
| 101 |
those owned by the user that also owns the inhibitor lock. If <literal>delay</literal> is used, the |
| 102 |
lock can only delay the requested operations for a limited time. If the time elapses, the lock is |
| 103 |
ignored and the operation executed. The time limit may be specified in |
| 104 |
<citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>. |
| 105 |
Note that <literal>delay</literal> is only available for <literal>sleep</literal> and |
| 106 |
<literal>shutdown</literal>.</para></listitem> |
| 107 |
</varlistentry> |
| 108 |
|
| 109 |
<varlistentry> |
| 110 |
<term><option>--list</option></term> |
| 111 |
|
| 112 |
<listitem><para>Lists all active inhibition locks instead of acquiring one. It can be filtered using |
| 113 |
<option>--what=</option>, <option>--who=</option>, <option>--why=</option>, or |
| 114 |
<option>--mode=</option>.</para></listitem> |
| 115 |
</varlistentry> |
| 116 |
|
| 117 |
<xi:include href="standard-options.xml" xpointer="no-ask-password" /> |
| 118 |
<xi:include href="standard-options.xml" xpointer="no-pager" /> |
| 119 |
<xi:include href="standard-options.xml" xpointer="no-legend" /> |
| 120 |
<xi:include href="standard-options.xml" xpointer="json" /> |
| 121 |
<xi:include href="standard-options.xml" xpointer="help" /> |
| 122 |
<xi:include href="standard-options.xml" xpointer="version" /> |
| 123 |
</variablelist> |
| 124 |
|
| 125 |
</refsect1> |
| 126 |
|
| 127 |
<refsect1> |
| 128 |
<title>Exit status</title> |
| 129 |
|
| 130 |
<para>Returns the exit status of the executed program.</para> |
| 131 |
</refsect1> |
| 132 |
|
| 133 |
<refsect1> |
| 134 |
<title>Example</title> |
| 135 |
|
| 136 |
<programlisting># systemd-inhibit wodim foobar.iso</programlisting> |
| 137 |
|
| 138 |
<para>This burns the ISO image |
| 139 |
<filename>foobar.iso</filename> on a CD using |
| 140 |
<citerefentry project='man-pages'><refentrytitle>wodim</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
| 141 |
and inhibits system sleeping, shutdown and idle while |
| 142 |
doing so.</para> |
| 143 |
</refsect1> |
| 144 |
|
| 145 |
<xi:include href="common-variables.xml" /> |
| 146 |
|
| 147 |
<refsect1> |
| 148 |
<title>See Also</title> |
| 149 |
<para><simplelist type="inline"> |
| 150 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 151 |
<member><citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 152 |
</simplelist></para> |
| 153 |
</refsect1> |
| 154 |
|
| 155 |
</refentry> |