#!/bin/bash # DigiTemp RRD logging script # Copyright 1997-2002 by Brian C. Lane <bcl@brianlane.com> www.brianlane.com # All Rights Reserved # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # # Call this from crontab every 5 minutes. Make sure the .digitemprc is in # your root directory or specify the configuration file using -c filename # on the digitemp command line in the reading variable below. # Get the current temperatures, digitemp has been previously initalized with # digitemp -i -s /dev/ttyS0 -o2 -a # Run it in quiet mode, output is 0\tsensor#1\tsensor#2\tsensor#3 reading=`/usr/local/bin/digitemp -a -q` # Diagnostic output room=`echo $reading | gawk '{print $2}'` attic=`echo $reading | gawk '{print $3}'` drink=`echo $reading | gawk '{print $4}'` # Update the database /usr/local/rrdtool/bin/rrdtool update /root/rrdb/digitemp.rrd N:$room:$drink:$attic