sensor_battery revision 1.4 1 #!/bin/sh -
2 #
3 # $NetBSD: sensor_battery,v 1.4 2007/10/10 23:25:39 xtraeme Exp $
4 #
5 # Generic script for battery sensors.
6 #
7 # Arguments passed by powerd(8):
8 #
9 # script_path device event sensor state_description
10 #
11 case "${2}" in
12 normal)
13 logger -p warning \
14 "${0}: (${3}) capacity reached normal state [${1}]" >&1
15 exit 0
16 ;;
17 state-changed)
18 logger -p warning "${0}: (${3}) state changed to ${4} [${1}]" >&1
19 exit 0
20 ;;
21 user-capacity)
22 logger -p warning \
23 "${0}: (${3}) user defined capacity dropped below limit [${1}]" >&1
24 exit 0
25 ;;
26 #
27 # This event is _ONLY_ received when all AC Adapters are OFF and all
28 # batteries on the system are in CRITICAL or LOW state.
29 #
30 # It is not recommended to remove the shutdown call.
31 #
32 low-power)
33 /sbin/shutdown -p now "${0}: LOW POWER! SHUTTING DOWN."
34 exit 0
35 ;;
36 *)
37 logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
38 exit 1
39 ;;
40 esac
41