Only three events are reported now:

normal
	state-changed
	user-capacity

But there's a fourth argument passed to the script that will report
current state description.
This commit is contained in:
xtraeme 2007-09-04 16:59:49 +00:00
parent debeab5278
commit 29742be0c4
1 changed files with 6 additions and 14 deletions

View File

@ -1,32 +1,24 @@
#!/bin/sh -
#
# $NetBSD: sensor_battery,v 1.2 2007/07/17 13:56:25 xtraeme Exp $
# $NetBSD: sensor_battery,v 1.3 2007/09/04 16:59:49 xtraeme Exp $
#
# Generic script for battery sensors.
#
# Arguments passed by powerd(8):
#
# script_path device event sensor
# script_path device event sensor state_description
case "${2}" in
normal)
logger -p warning "${0}: ${3}: NORMAL: capacity reached normal state (${1})" >&1
logger -p warning "${0}: (${3}) capacity reached normal state (${1})" >&1
exit 0
;;
critical)
logger -p warning "${0}: ${3}: CRITICAL: capacity dropped below limit! (${1})" >&1
exit 0
;;
warning-under)
logger -p warning "${0}: ${3}: WARNING: capacity dropped below limit (${1})" >&1
exit 0
;;
critical-under)
logger -p warning "${0}: ${3}: CRITICAL: capacity dropped below low critical limit! (${1})" >&1
state-changed)
logger -p warning "${0}: (${3}) state changed to ${4} [${1}]" >&1
exit 0
;;
user-capacity)
logger -p warning "${0}: ${3}: USER DEFINED: capacity dropped below limit (${1})" >&1
logger -p warning "${0}: (${3}) USER DEFINED: capacity dropped below limit (${1})" >&1
exit 0
;;
*)