Linux command
systemd-inhibit 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
List
systemd-inhibit --list
Block
systemd-inhibit --what shutdown [command]
Keep
systemd-inhibit --what sleep:idle wget [https://example.com/file]
Ignore
systemd-inhibit --what sleep:handle-lid-switch [path/to/script]
Ignore
systemd-inhibit --what handle-power-key [command]
Describe
systemd-inhibit --who [$USER] --why [reason] --what [operation] [command]
说明
systemd-inhibit creates inhibitor locks that can block or delay system sleep, shutdown, and hardware key handling while a command runs. The lock is held for the duration of the command's execution. Multiple operations can be specified by separating them with colons. The --list option shows all active inhibitors from all sources, not just those created by this tool.
参数
- --list
- List all active inhibitor locks
- --what _operation_
- Operations to inhibit (shutdown, sleep, idle, handle-power-key, handle-suspend-key, handle-hibernate-key, handle-lid-switch)
- --who _name_
- Descriptive name of who is holding the lock
- --why _reason_
- Descriptive reason for holding the lock
- --mode _mode_
- Either "block" or "delay"
FAQ
What is the systemd-inhibit command used for?
systemd-inhibit creates inhibitor locks that can block or delay system sleep, shutdown, and hardware key handling while a command runs. The lock is held for the duration of the command's execution. Multiple operations can be specified by separating them with colons. The --list option shows all active inhibitors from all sources, not just those created by this tool.
How do I run a basic systemd-inhibit example?
Run `systemd-inhibit --list` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --list do in systemd-inhibit?
List all active inhibitor locks