48 lines
706 B
Bash
Executable File
48 lines
706 B
Bash
Executable File
#! /bin/sh
|
|
|
|
: <<=cut
|
|
|
|
=head1 NAME
|
|
|
|
rpi_temp - monitor the temperature of a Raspberry device
|
|
|
|
|
|
=head1 AUTHORS
|
|
|
|
Copyright (C) 2013 Steve Schnepp <steve.schnepp@pwkf.org>
|
|
|
|
|
|
=head1 LICENSE
|
|
|
|
GNU Library General Public License v2 only
|
|
|
|
SPDX-License-Identifier: LGPL-2.0-only
|
|
|
|
=cut
|
|
|
|
|
|
if [ ! -r "/sys/class/thermal/thermal_zone0/temp" ]
|
|
then
|
|
echo "# Cannot read CPU Temp"
|
|
exit 1
|
|
fi
|
|
|
|
|
|
if [ "$1" = "config" ]
|
|
then
|
|
cat <<EOF
|
|
graph_title CPU Temp
|
|
graph_category system
|
|
graph_vlabel C
|
|
thermal_zone0.label Current CPU Temp
|
|
EOF
|
|
exit 0
|
|
fi
|
|
|
|
# values
|
|
TEMP_MILLI_C=$(cat /sys/class/thermal/thermal_zone0/temp)
|
|
|
|
echo "thermal_zone0.value $(echo "$TEMP_MILLI_C" | awk '{printf("%0.3f", $1 / 1000)}')"
|
|
|
|
exit 0
|