diff options
author | Michael Hanson <hansonorders@verison.net> | 2010-03-19 22:55:30 (GMT) |
---|---|---|
committer | Michael Hanson <hansonorders@verison.net> | 2010-03-19 22:55:30 (GMT) |
commit | 9cd1a553eb5bd92559c85c1feec6af80d0c709cc (patch) | |
tree | 1a691ae8f78bc5a527244f822c68d0975b857cc8 /abs/extra-testing/lm_sensors/healthd | |
parent | 91eecacd35bd5d4fe98e5d2c17e7612f6eea593c (diff) | |
download | linhes_pkgbuild-9cd1a553eb5bd92559c85c1feec6af80d0c709cc.zip linhes_pkgbuild-9cd1a553eb5bd92559c85c1feec6af80d0c709cc.tar.gz linhes_pkgbuild-9cd1a553eb5bd92559c85c1feec6af80d0c709cc.tar.bz2 |
lm_sensors: Upgrade pkg to 3.1.2. Still needs runit support.
Closes FS#623.
Diffstat (limited to 'abs/extra-testing/lm_sensors/healthd')
-rw-r--r-- | abs/extra-testing/lm_sensors/healthd | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/abs/extra-testing/lm_sensors/healthd b/abs/extra-testing/lm_sensors/healthd new file mode 100644 index 0000000..0315dd7 --- /dev/null +++ b/abs/extra-testing/lm_sensors/healthd @@ -0,0 +1,46 @@ +#!/bin/bash + +# +# /usr/sbin/healthd +# + +. /etc/conf.d/healthd + +cmd="${ALARM_CMD}" +addr="${ADMIN_EMAIL}" +slp="${ALARM_SLEEP}" +sensors="/usr/bin/sensors" + + +while [ $# -gt 0 ] ; do + case "${1}" in + -c ) cmd="${2}" ; shift 2 ;; + -m ) addr="${2}" ; shift 2 ;; + -s ) slp="${2}" ; shift 2 ;; + * ) shift 1 ;; + esac +done + +[ -n "${cmd}" ] && [ -n "$( which -- "${cmd%% *}" )" ] || \ + [ -n "${addr}" ] || exit 1 + +[ "${slp}" -ge 2 ] || slp=600 + +while true ; do + sleep 15 + message="$( $sensors )" + case "$message" in + '' ) message='Could not get any sensor values !' ;; + *ALARM* ) : ;; + * ) message='' ;; + esac + if [ -n "$message" ]; then + if [ -n "${addr}" ]; then + echo "$message" | mail -s \ + "Sensors ALARM detected at host: $( hostname )" \ + "${addr}" + fi + [ -z "${cmd}" ] || ${cmd} & + sleep ${slp} + fi +done & |