Skip to content

Instantly share code, notes, and snippets.

@azbesthu
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azbesthu/ac5f04a4243c937afa90 to your computer and use it in GitHub Desktop.
Save azbesthu/ac5f04a4243c937afa90 to your computer and use it in GitHub Desktop.
#!/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