Now use whereis to find the sensors program instead of assuming a path. Also mention help in the readme if the program is not found.

This commit is contained in:
Ryan Loudfoot 2014-09-06 16:36:21 -04:00
parent 75b4a1c6d6
commit 615089a044

View File

@ -33,11 +33,11 @@
# # # #
############################################################################### ###############################################################################
VERSION="Version 0.92" VERSION="Version 0.93"
AUTHOR="(c) 2011 Jack-Benny Persson (jack-benny@cyberinfo.se)" AUTHOR="(c) 2011 Jack-Benny Persson (jack-benny@cyberinfo.se)"
# Sensor program # Sensor program
SENSORPROG=/usr/bin/sensors SENSORPROG=$(whereis -b -B /{bin,usr,etc}/* -f sensors | awk '{print $2}')
# Ryan's note: utils.sh is installed with nagios-plugins in with the plugins # Ryan's note: utils.sh is installed with nagios-plugins in with the plugins
# Check if utils.sh exists. This lets you use check_domain in a testing environment # Check if utils.sh exists. This lets you use check_domain in a testing environment
@ -100,7 +100,7 @@ sensor=CPU
# See if we have sensors program installed and can execute it # See if we have sensors program installed and can execute it
if [[ ! -x "$SENSORPROG" ]]; then if [[ ! -x "$SENSORPROG" ]]; then
echo "It appears you don't have lm-sensors installed in $SENSORPROG" echo "It appears you don't have lm-sensors installed. You may find help in the readme for this script."
exit $STATE_UNKNOWN exit $STATE_UNKNOWN
fi fi