1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00
systemd/man/systemd-ac-power.xml
Lennart Poettering 7f1520c6a1 ac-power: add --low switch to systemd-ac-power tool
This allows checking from shell scripts whether the system is in a low
battery state. It just exposed the code we anyway have in a directly
accessible way.

This is also very useful for testing things.
2023-06-05 12:21:28 +02:00

80 lines
2.5 KiB
XML

<?xml version='1.0'?> <!--*-nxml-*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
<refentry id="systemd-ac-power" xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>systemd-ac-power</title>
<productname>systemd</productname>
</refentryinfo>
<refmeta>
<refentrytitle>systemd-ac-power</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>systemd-ac-power</refname>
<refpurpose>Report whether we are connected to an external power source</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>systemd-ac-power</command>
<arg choice="opt" rep="repeat">OPTIONS</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><command>systemd-ac-power</command> may be used to check whether the system
is running on AC power or not. By default it will simply return success (if we
can detect that we are running on AC power) or failure, with no output.
This can be useful for example to debug <varname>ConditionACPower=</varname> (see
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>).</para>
</refsect1>
<refsect1>
<title>Options</title>
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>-v</option></term>
<term><option>--verbose</option></term>
<listitem><para>Show result as text instead of just returning success or failure.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--low</option></term>
<listitem><para>Instead of showing AC power state, show low battery state. In this case will return
zero if all batteries are currently discharging and below 5% of maximum charge. Returns non-zero
otherwise.</para></listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
</variablelist>
</refsect1>
<refsect1>
<title>Exit status</title>
<para>On success (running on AC power), 0 is returned, a non-zero failure code otherwise.</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>