NetBSD/etc/powerd/scripts/sensor_temperature

43 lines
995 B
Bash
Executable File

#!/bin/sh -
#
# $NetBSD: sensor_temperature,v 1.4 2012/04/10 13:58:52 jruoho Exp $
#
# Generic script for temperature sensors.
#
# Arguments passed by powerd(8):
#
# script_path device event sensor
case "${2}" in
normal)
logger -p warning "${0}: ($1) normal state entered [${3}]" >&1
exit 0
;;
critical)
logger -p warning "${0}: ($1) critical state entered [${3}]" >&1
/sbin/shutdown -p now "${0}: CRITICAL TEMPERATURE! SHUTTING DOWN."
exit 0
;;
critical-under)
logger -p warning "${0}: ($1) dropped below critical limit [${3}]" >&1
exit 0
;;
critical-over)
logger -p warning "${0}: ($1) critical limit exceeded [${3}]" >&1
/sbin/shutdown -p now "${0}: CRITICAL TEMPERATURE! SHUTTING DOWN."
exit 0
;;
warning-under)
logger -p warning "${0}: ($1) dropped below warning limit [${3}]" >&1
exit 0
;;
warning-over)
logger -p warning "${0}: ($1) warning limit exceeded [${3}]" >&1
exit 0
;;
*)
logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
exit 1
;;
esac