#!/bin/sh - # # $NetBSD: sensor_battery,v 1.5 2007/10/11 19:47:26 xtraeme Exp $ # # Generic script for battery sensors. # # Arguments passed by powerd(8): # # script_path device event sensor state_description # case "${2}" in normal) logger -p warning \ "${0}: (${3}) capacity reached normal state [${1}]" >&1 exit 0 ;; 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 exit 0 ;; # # This event is _ONLY_ received when all AC Adapters are OFF and all # batteries on the system are in CRITICAL or LOW state. # # It is not recommended to remove the shutdown call. # low-power) logger -p warning "${0}: LOW POWER! SHUTTING DOWN." >&1 /sbin/shutdown -p now "${0}: LOW POWER! SHUTTING DOWN." exit 0 ;; *) logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1 exit 1 ;; esac