Linux command
systemd-ac-power 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Example
systemd-ac-power
Example
systemd-ac-power -v
说明
systemd-ac-power reports whether the computer is connected to an external power source (AC mains). It returns exit code 0 when on AC power and non-zero when on battery. This is useful in scripts and systemd unit conditions to change behavior based on power state.
参数
- -v, --verbose
- Print "yes" or "no" to stdout in addition to exit code
- -h, --help
- Display help
FAQ
What is the systemd-ac-power command used for?
systemd-ac-power reports whether the computer is connected to an external power source (AC mains). It returns exit code 0 when on AC power and non-zero when on battery. This is useful in scripts and systemd unit conditions to change behavior based on power state.
How do I run a basic systemd-ac-power example?
Run `systemd-ac-power` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -v, --verbose do in systemd-ac-power?
Print "yes" or "no" to stdout in addition to exit code