1#!/bin/sh - 2# 3# $NetBSD: sensor_battery,v 1.5 2007/10/11 19:47:26 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# 11case "${2}" in 12normal) 13 logger -p warning \ 14 "${0}: (${3}) capacity reached normal state [${1}]" >&1 15 exit 0 16 ;; 17state-changed) 18 logger -p warning "${0}: (${3}) state changed to ${4} [${1}]" >&1 19 exit 0 20 ;; 21user-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# 32low-power) 33 logger -p warning "${0}: LOW POWER! SHUTTING DOWN." >&1 34 /sbin/shutdown -p now "${0}: LOW POWER! SHUTTING DOWN." 35 exit 0 36 ;; 37*) 38 logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1 39 exit 1 40 ;; 41esac 42