1SYSTEMD-INHIBIT(1) systemd-inhibit SYSTEMD-INHIBIT(1)
2
3
4
6 systemd-inhibit - Execute a program with an inhibition lock taken
7
9 systemd-inhibit [OPTIONS...] [COMMAND] [ARGUMENTS...]
10
11 systemd-inhibit [OPTIONS...] --list
12
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
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, suspending/hibernating,
33 the automatic idle detection, or the low-level handling of the
34 power/sleep key and the lid switch, respectively. If omitted,
35 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
73 Returns the exit status of the executed program.
74
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
82 $SYSTEMD_PAGER
83 Pager to use when --no-pager is not given; overrides $PAGER. If
84 neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
85 pager implementations are tried in turn, including less(1) and
86 more(1), until one is found. If no pager implementation is
87 discovered no pager is invoked. Setting this environment variable
88 to an empty string or the value "cat" is equivalent to passing
89 --no-pager.
90
91 $SYSTEMD_LESS
92 Override the options passed to less (by default "FRSXMK").
93
94 Users might want to change two options in particular:
95
96 K
97 This option instructs the pager to exit immediately when Ctrl+C
98 is pressed. To allow less to handle Ctrl+C itself to switch
99 back to the pager command prompt, unset this option.
100
101 If the value of $SYSTEMD_LESS does not include "K", and the
102 pager that is invoked is less, Ctrl+C will be ignored by the
103 executable, and needs to be handled by the pager.
104
105 X
106 This option instructs the pager to not send termcap
107 initialization and deinitialization strings to the terminal. It
108 is set by default to allow command output to remain visible in
109 the terminal even after the pager exits. Nevertheless, this
110 prevents some pager functionality from working, in particular
111 paged output cannot be scrolled with the mouse.
112
113 See less(1) for more discussion.
114
115 $SYSTEMD_LESSCHARSET
116 Override the charset passed to less (by default "utf-8", if the
117 invoking terminal is determined to be UTF-8 compatible).
118
119 $SYSTEMD_PAGERSECURE
120 Takes a boolean argument. When true, the "secure" mode of the pager
121 is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set
122 at all, secure mode is enabled if the effective UID is not the same
123 as the owner of the login session, see geteuid(2) and
124 sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set
125 when invoking the pager, and the pager shall disable commands that
126 open or create new files or start new subprocesses. When
127 $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known
128 to implement secure mode will not be used. (Currently only less(1)
129 implements secure mode.)
130
131 Note: when commands are invoked with elevated privileges, for
132 example under sudo(8) or pkexec(1), care must be taken to ensure
133 that unintended interactive features are not enabled. "Secure" mode
134 for the pager may be enabled automatically as describe above.
135 Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited
136 environment allows the user to invoke arbitrary commands. Note that
137 if the $SYSTEMD_PAGER or $PAGER variables are to be honoured,
138 $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to
139 completly disable the pager using --no-pager instead.
140
141 $SYSTEMD_COLORS
142 The value must be a boolean. Controls whether colorized output
143 should be generated. This can be specified to override the decision
144 that systemd makes based on $TERM and what the console is connected
145 to.
146
147 $SYSTEMD_URLIFY
148 The value must be a boolean. Controls whether clickable links
149 should be generated in the output for terminal emulators supporting
150 this. This can be specified to override the decision that systemd
151 makes based on $TERM and other conditions.
152
154 systemd(1), logind.conf(5)
155
157 1. Inhibitor Lock Developer Documentation
158 https://www.freedesktop.org/wiki/Software/systemd/inhibit
159
160
161
162systemd 246 SYSTEMD-INHIBIT(1)