2013-06-02 23:14:07 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Where is pcsensor located?
|
|
|
|
PCSENSOR="/usr/local/bin/pcsensor"
|
|
|
|
|
|
|
|
if [ ! -e ${PCSENSOR} ]; then
|
|
|
|
echo "pcsensor executable not found" >&2
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${1}" = "config" ]; then
|
|
|
|
echo "graph_title TEMPer USB Thermometer"
|
|
|
|
echo "graph_scale no"
|
|
|
|
echo "graph_vlabel Celsius"
|
|
|
|
echo "graph_category sensors"
|
|
|
|
echo "graph_info This graph shows the temperature reported by the first attached TEMPer USB Thermometer"
|
|
|
|
|
|
|
|
echo "temp.label temperatue"
|
|
|
|
echo "temp.type GAUGE"
|
|
|
|
else
|
2019-12-27 17:50:00 +01:00
|
|
|
TEMP=$(${PCSENSOR} -cm)
|
2014-12-30 18:01:19 +01:00
|
|
|
if [[ $? != 0 ]]; then
|
2015-01-01 20:15:21 +01:00
|
|
|
sleep 2
|
2019-12-27 17:50:00 +01:00
|
|
|
TEMP=$(${PCSENSOR} -cm)
|
2015-01-01 20:15:21 +01:00
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
sleep 6
|
2019-12-27 17:50:00 +01:00
|
|
|
TEMP=$(${PCSENSOR} -cm)
|
2015-01-01 20:15:21 +01:00
|
|
|
fi
|
2014-12-30 18:01:19 +01:00
|
|
|
fi
|
2019-12-27 17:50:00 +01:00
|
|
|
echo "temp.value $(echo -n "$TEMP" | head -n 1)"
|
2013-06-02 23:14:07 +02:00
|
|
|
fi
|