A simple battery daemon written for use with a daemontools-style supervisor.
run polls the status of a
check function with an interleaved call to
interval. On the transition from a successful
check exit status to an
check exit status the
failed function is called.
# ./install /etc/sv/battd # ln -s /etc/sv/battd /var/service
Adjust the above as needed.
conf appropriately. This should contain three functions:
: Called between consecutive calls to
: Called to determine the battery status.
: Called when the battery status has transitioned from a successful to a
conf is included and installed alongside the run script. An
battcheck awk script takes two optional arguments and a path to the
uevent file of a battery to determine if the battery capacity and estimated
run-time meet the specified criteria. Multiple invocations of
battcheck can be
used to handle more complex logic involving multiple batteries.