1SYSTEMD-INHIBIT(1)              systemd-inhibit             SYSTEMD-INHIBIT(1)
2
3
4

NAME

6       systemd-inhibit - Execute a program with an inhibition lock taken
7

SYNOPSIS

9       systemd-inhibit [OPTIONS...] [COMMAND] [ARGUMENTS...]
10
11       systemd-inhibit [OPTIONS...] --list
12

DESCRIPTION

14       systemd-inhibit may be used to execute a program with a shutdown,
15       sleep, or idle inhibitor lock taken. The lock will be acquired before
16       the specified command line is executed and released afterwards.
17
18       Inhibitor locks may be used to block or delay system sleep and shutdown
19       requests from the user, as well as automatic idle handling of the OS.
20       This is useful to avoid system suspends while an optical disc is being
21       recorded, or similar operations that should not be interrupted.
22
23       For more information see the Inhibitor Lock Developer Documentation[1].
24

OPTIONS

26       The following options are understood:
27
28       --what=
29           Takes a colon-separated list of one or more operations to inhibit:
30           "shutdown", "sleep", "idle", "handle-power-key",
31           "handle-suspend-key", "handle-hibernate-key", "handle-lid-switch",
32           for inhibiting reboot/power-off/halt/kexec/soft-reboot,
33           suspending/hibernating, the automatic idle detection, or the
34           low-level handling of the power/sleep key and the lid switch,
35           respectively. If omitted, defaults to "idle:sleep:shutdown".
36
37       --who=
38           Takes a short, human-readable descriptive string for the program
39           taking the lock. If not passed, defaults to the command line
40           string.
41
42       --why=
43           Takes a short, human-readable descriptive string for the reason for
44           taking the lock. Defaults to "Unknown reason".
45
46       --mode=
47           Takes either "block" or "delay" and describes how the lock is
48           applied. If "block" is used (the default), the lock prohibits any
49           of the requested operations without time limit, and only privileged
50           users may override it. If "delay" is used, the lock can only delay
51           the requested operations for a limited time. If the time elapses,
52           the lock is ignored and the operation executed. The time limit may
53           be specified in logind.conf(5). Note that "delay" is only available
54           for "sleep" and "shutdown".
55
56       --list
57           Lists all active inhibition locks instead of acquiring one.
58
59       --no-pager
60           Do not pipe output into a pager.
61
62       --no-legend
63           Do not print the legend, i.e. column headers and the footer with
64           hints.
65
66       -h, --help
67           Print a short help text and exit.
68
69       --version
70           Print a short version string and exit.
71

EXIT STATUS

73       Returns the exit status of the executed program.
74

EXAMPLE

76           # systemd-inhibit wodim foobar.iso
77
78       This burns the ISO image foobar.iso on a CD using wodim(1), and
79       inhibits system sleeping, shutdown and idle while doing so.
80

ENVIRONMENT

82       $SYSTEMD_LOG_LEVEL
83           The maximum log level of emitted messages (messages with a higher
84           log level, i.e. less important ones, will be suppressed). Either
85           one of (in order of decreasing importance) emerg, alert, crit, err,
86           warning, notice, info, debug, or an integer in the range 0...7. See
87           syslog(3) for more information.
88
89       $SYSTEMD_LOG_COLOR
90           A boolean. If true, messages written to the tty will be colored
91           according to priority.
92
93           This setting is only useful when messages are written directly to
94           the terminal, because journalctl(1) and other tools that display
95           logs will color messages based on the log level on their own.
96
97       $SYSTEMD_LOG_TIME
98           A boolean. If true, console log messages will be prefixed with a
99           timestamp.
100
101           This setting is only useful when messages are written directly to
102           the terminal or a file, because journalctl(1) and other tools that
103           display logs will attach timestamps based on the entry metadata on
104           their own.
105
106       $SYSTEMD_LOG_LOCATION
107           A boolean. If true, messages will be prefixed with a filename and
108           line number in the source code where the message originates.
109
110           Note that the log location is often attached as metadata to journal
111           entries anyway. Including it directly in the message text can
112           nevertheless be convenient when debugging programs.
113
114       $SYSTEMD_LOG_TID
115           A boolean. If true, messages will be prefixed with the current
116           numerical thread ID (TID).
117
118           Note that the this information is attached as metadata to journal
119           entries anyway. Including it directly in the message text can
120           nevertheless be convenient when debugging programs.
121
122       $SYSTEMD_LOG_TARGET
123           The destination for log messages. One of console (log to the
124           attached tty), console-prefixed (log to the attached tty but with
125           prefixes encoding the log level and "facility", see syslog(3), kmsg
126           (log to the kernel circular log buffer), journal (log to the
127           journal), journal-or-kmsg (log to the journal if available, and to
128           kmsg otherwise), auto (determine the appropriate log target
129           automatically, the default), null (disable log output).
130
131       $SYSTEMD_LOG_RATELIMIT_KMSG
132           Whether to ratelimit kmsg or not. Takes a boolean. Defaults to
133           "true". If disabled, systemd will not ratelimit messages written to
134           kmsg.
135
136       $SYSTEMD_PAGER
137           Pager to use when --no-pager is not given; overrides $PAGER. If
138           neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
139           pager implementations are tried in turn, including less(1) and
140           more(1), until one is found. If no pager implementation is
141           discovered no pager is invoked. Setting this environment variable
142           to an empty string or the value "cat" is equivalent to passing
143           --no-pager.
144
145           Note: if $SYSTEMD_PAGERSECURE is not set, $SYSTEMD_PAGER (as well
146           as $PAGER) will be silently ignored.
147
148       $SYSTEMD_LESS
149           Override the options passed to less (by default "FRSXMK").
150
151           Users might want to change two options in particular:
152
153           K
154               This option instructs the pager to exit immediately when Ctrl+C
155               is pressed. To allow less to handle Ctrl+C itself to switch
156               back to the pager command prompt, unset this option.
157
158               If the value of $SYSTEMD_LESS does not include "K", and the
159               pager that is invoked is less, Ctrl+C will be ignored by the
160               executable, and needs to be handled by the pager.
161
162           X
163               This option instructs the pager to not send termcap
164               initialization and deinitialization strings to the terminal. It
165               is set by default to allow command output to remain visible in
166               the terminal even after the pager exits. Nevertheless, this
167               prevents some pager functionality from working, in particular
168               paged output cannot be scrolled with the mouse.
169
170           See less(1) for more discussion.
171
172       $SYSTEMD_LESSCHARSET
173           Override the charset passed to less (by default "utf-8", if the
174           invoking terminal is determined to be UTF-8 compatible).
175
176       $SYSTEMD_PAGERSECURE
177           Takes a boolean argument. When true, the "secure" mode of the pager
178           is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set
179           at all, secure mode is enabled if the effective UID is not the same
180           as the owner of the login session, see geteuid(2) and
181           sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set
182           when invoking the pager, and the pager shall disable commands that
183           open or create new files or start new subprocesses. When
184           $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known
185           to implement secure mode will not be used. (Currently only less(1)
186           implements secure mode.)
187
188           Note: when commands are invoked with elevated privileges, for
189           example under sudo(8) or pkexec(1), care must be taken to ensure
190           that unintended interactive features are not enabled. "Secure" mode
191           for the pager may be enabled automatically as describe above.
192           Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited
193           environment allows the user to invoke arbitrary commands. Note that
194           if the $SYSTEMD_PAGER or $PAGER variables are to be honoured,
195           $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to
196           completely disable the pager using --no-pager instead.
197
198       $SYSTEMD_COLORS
199           Takes a boolean argument. When true, systemd and related utilities
200           will use colors in their output, otherwise the output will be
201           monochrome. Additionally, the variable can take one of the
202           following special values: "16", "256" to restrict the use of colors
203           to the base 16 or 256 ANSI colors, respectively. This can be
204           specified to override the automatic decision based on $TERM and
205           what the console is connected to.
206
207       $SYSTEMD_URLIFY
208           The value must be a boolean. Controls whether clickable links
209           should be generated in the output for terminal emulators supporting
210           this. This can be specified to override the decision that systemd
211           makes based on $TERM and other conditions.
212

SEE ALSO

214       systemd(1), logind.conf(5)
215

NOTES

217        1. Inhibitor Lock Developer Documentation
218           https://www.freedesktop.org/wiki/Software/systemd/inhibit
219
220
221
222systemd 254                                                 SYSTEMD-INHIBIT(1)
Impressum