Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / etc / powerd / scripts / sensor_battery
bloba9a59956b0a0b3e664a3fb31d775f07c623c7e1c
1 #!/bin/sh -
3 # $NetBSD: sensor_battery,v 1.5 2007/10/11 19:47:26 xtraeme Exp $
5 # Generic script for battery sensors.
7 # Arguments passed by powerd(8):
9 # script_path device event sensor state_description
11 case "${2}" in
12 normal)
13 logger -p warning \
14 "${0}: (${3}) capacity reached normal state [${1}]" >&1
15 exit 0
17 state-changed)
18 logger -p warning "${0}: (${3}) state changed to ${4} [${1}]" >&1
19 exit 0
21 warning-capacity)
22 logger -p warning \
23 "${0}: (${3}) capacity below warning limit [${1}]" >&1
24 exit 0
26 critical-capacity)
27 logger -p warning \
28 "${0}: (${3}) capacity below critical limit [${1}]" >&1
29 exit 0
32 # This event is _ONLY_ received when all AC Adapters are OFF and all
33 # batteries on the system are in CRITICAL or LOW state.
35 # It is not recommended to remove the shutdown call.
37 low-power)
38 logger -p warning "${0}: LOW POWER! SHUTTING DOWN." >&1
39 /sbin/shutdown -p now "${0}: LOW POWER! SHUTTING DOWN."
40 exit 0
43 logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
44 exit 1
46 esac