diff options
author | Jean Delvare <khali@linux-fr.org> | 2015-02-28 09:11:05 +0000 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2015-02-28 09:11:05 +0000 |
commit | 53d852c9b5f500e23c4521f34228dc3215bce50e (patch) | |
tree | 1097a349efeda2a06b13be69cc6b24a66f17aef8 | |
parent | 266a45579c01e81f0b8719bedb11a3bea6104286 (diff) | |
download | lm-sensors-git-53d852c9b5f500e23c4521f34228dc3215bce50e.tar.gz |
healthd.sh: Decrease the resource consumption by replacing the
external commands with the built-in bash commands. Contributed by
vbooh.
-rw-r--r-- | CHANGES | 1 | ||||
-rwxr-xr-x | prog/daemon/healthd.sh | 12 |
2 files changed, 8 insertions, 5 deletions
@@ -10,6 +10,7 @@ SVN HEAD sensors: Add support for temperature min and critical min hysteresis fancontrol: Deal with moving hwmon attributes Fix shell error when FCFANS is not set + healthd: Avoid using external commands sensors-detect: Add detection of ADC128D818 Add detection of AMD family 16h Kabini and Mullins Add detection of ITE IT8620E and IT8623E diff --git a/prog/daemon/healthd.sh b/prog/daemon/healthd.sh index 5986ca64..a17b92f5 100755 --- a/prog/daemon/healthd.sh +++ b/prog/daemon/healthd.sh @@ -25,7 +25,8 @@ PATH="/bin:/usr/bin:/usr/local/bin:${PATH}" ADMIN_EMAIL="root@localhost" -if [ -n "`sensors | grep ALARM`" ] +sensors_state=$(sensors) +if [[ "$sensors_state" =~ 'ALARM' ]] then echo "Pending Alarms on start up! Exiting!" exit @@ -33,10 +34,11 @@ fi while true do - sleep 15 - if [ -n "`sensors | grep ALARM`" ] + read -t 15 -N 0 + sensors_state=$(sensors) + if [[ "$sensors_state" =~ 'ALARM' ]] then - sensors | mail -s "**** Hardware Health Warning ****" $ADMIN_EMAIL - sleep 600 + echo "$sensors_state" | mail -s '**** Hardware Health Warning ****' $ADMIN_EMAIL + read -t 600 -N 0 fi done |