Skip to content

Instantly share code, notes, and snippets.

@azbesthu
Last active Aug 29, 2015
Embed
What would you like to do?
#!/bin/sh
# Where is pcsensor located?
PCSENSOR="/usr/local/bin/pcsensor"
if [ ! -e ${PCSENSOR} ]; then
echo "Cannot find pcsensor executable" >&2
exit -1
fi
case $1 in
config)
echo "
graph_title TEMPer USB Thermometer
graph_vlabel Celsius
graph_info This graph shows the temperatur reported by the attached TEMPer USB Thermometer.
graph_category Sensors
temp.label temp
temp.draw AREA
temp.colour FFD700
# < water freezes, > high fever
temp.warning 15:25
# sensor max
temp.critical 10:40
"
exit 0;;
esac
echo -n "temp.value "
while true
do
outtmp=`${PCSENSOR} -cm`
if [ $? -eq 0 ]; then
output=`echo $outtmp | awk '{print $1;}'`
echo $output
break
else
sleep 1s
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment