summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0>2015-03-03 09:02:31 +0000
committerkhali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0>2015-03-03 09:02:31 +0000
commit3e55c4918b335df971f0629c777257e00d6112f3 (patch)
treee78051d9de4560c0dda23eb146bcf9313ff38ac7
parent9efffc4d3cbf102902d9f987a67da3009e787b40 (diff)
downloadlm-sensors-3e55c4918b335df971f0629c777257e00d6112f3.tar.gz
healthd.sh: Revert to regular sleep
The read trick did not work when the daemon is started by systemd. So we call sleep again, but we try to use the builtin flavor when available. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6275 7894878c-1315-0410-8ee3-d5d059ff63e0
-rwxr-xr-xprog/daemon/healthd.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/prog/daemon/healthd.sh b/prog/daemon/healthd.sh
index 63bc0310..6e80f85a 100755
--- a/prog/daemon/healthd.sh
+++ b/prog/daemon/healthd.sh
@@ -13,7 +13,7 @@
# This is just an example. It works, but hopefully we can
# get something better written. :')
#
-# Requirements -- grep, mail, sensors, bash
+# Requirements -- mail, sensors, bash, sleep
# (You may need to alter the PATH, but probably not.)
#
# Written & Copyrighten by Philip Edelbrock, 1999.
@@ -25,6 +25,10 @@ PATH="/bin:/usr/bin:/usr/local/bin:${PATH}"
ADMIN_EMAIL="root@localhost"
+# Try loading the built-in sleep implementation to avoid spawning a
+# new process every 15 seconds
+enable -f sleep.so sleep >/dev/null 2>&1
+
sensors_state=$(sensors)
if [[ "$sensors_state" =~ 'ALARM' ]]
then
@@ -34,11 +38,11 @@ fi
while true
do
- read -t 15 -N 0
+ sleep 15
sensors_state=$(sensors)
if [[ "$sensors_state" =~ 'ALARM' ]]
then
echo "$sensors_state" | mail -s '**** Hardware Health Warning ****' $ADMIN_EMAIL
- read -t 600 -N 0
+ sleep 600
fi
done