Kod: Markera allt
#!/bin/bash
# Script to create rrd-file
# 24h with 2,5 min resolution
# 7d with 5 min resolution
# 1y with 10 min resolution
# 20y with 1h resolution
directory="/home/anders/rrddata/"
filename="outside_temp.rrd"
# Check i file already exists
if [ ! -f "$directory$filename" ]
then
# File doesn't exist, create new rrd-file
echo "Creating RRDtool DB for outside temp sensor"
rrdtool create $directory$filename \
--step 150 \
DS:outsidetemp:GAUGE:300:-50:60 \
RRA:AVERAGE:0.5:1:576 \
RRA:AVERAGE:0.5:2:2016 \
RRA:AVERAGE:0.5:4:52560 \
RRA:AVERAGE:0.5:24:175200 \
RRA:MAX:0.5:1:5760 \
RRA:MAX:0.5:2:2016 \
RRA:MAX:0.5:4:52560 \
RRA:MAX:0.5:24:175200 \
RRA:MIN:0.5:1:5760 \
RRA:MIN:0.5:2:2016 \
RRA:MIN:0.5:4:52560 \
RRA:MIN:0.5:24:175200
echo "Done!"
else
echo $directory$filename" already exists, delete it first."
fi
Kod: Markera allt
./create_rrd.sh: line 13: if [ ! -f /home/pi/rrdata/outside_temp.rrd ]: No such file or directory
./create_rrd.sh: line 14: syntax error near unexpected token `then'
./create_rrd.sh: line 14: `then'
Kod: Markera allt
./create_rrd.sh
Creating RRDtool DB for mobile temp sensor
ERROR: can't parse argument 'echo'
Kod: Markera allt
#!/bin/bash
# Script to create rrd-file
# 24h with 2.5 min resolution
# 7d with 5 min resolution
# 1y with 10 minresolution
# 20 y with 1h resolution
directory="/home/pi/rrddata/"
filename="mobile_temp.rrd"
# check if file already exists
if [ ! -f "$directory$filename" ]
then
# File doesn't exist, create new rrd-file
echo "Creating RRDtool DB for mobile temp sensor"
sudo rrdtool create $direcdtory$filename \
--step 150 \
DS:mobiletemp:GAUGE:300:-50:60 \
RRA:AVERAGE:0.5:1:576 \
RRA:AVERAGE:0.5:2:2016 \
RRA:AVERAGE:0.5:4:52560 \
RRA:AVERAGE:0.5:24:175200 \
RRA:MAX:0.5:2:5760 \
RRA:MAX:0.5:2:2016 \
RRA:MAX:0.5:4:52560 \
RRA:MAX:0.5:24:175200 \
RRA:MIN:0.5:1:5760 \
RRA:MIN:0.5:2:2016 \
RRA:MIN:0.5:4:52560 \
RRA:MIN:0.5:24:175200 \
echo "Done!"
else
echo $directory$filename" Already exists Delete"
fi
Kod: Markera allt
RRA:MIN:0.5:24:175200
Kod: Markera allt
pi@mobiletemp ~/bin $ ./graph_temp.pl
./graph_temp.pl: line 26: unexpected EOF while looking for matching `"'
./graph_temp.pl: line 27: syntax error: unexpected end of file
Kod: Markera allt
"!/usr/bin/perl
use RRDs;
my $cur_time = time();
my $start_time = $cur_time - 86400; #set end time to 24 hours ago
RRDs::graph "/var/www/graph_temp.png",
"--start= $start_time",
"--end= $cur_time",
"--title= Mobil temp",
"--height= 300",
"--width= 500",
"--vertical-label= Grader Celsius",
"DEF:MobileTemp=/homr/pi/rrddata/mobile_temp.rrd:mobiletemp:AVERAGE",
"COMMENT:\t\t\t\tNu Medel Max Min\\n",
"HRULE:0#0000FF",
"LINE2:MobileTemp#0000FF",
"GPRINT:MobileTemp:LAST:%6.11f",
"GPRINT:MobileTemp:AVERAGE:%6.11f",
"GPRINT:MobileTemp:MAX:%6.11f",
"GPRINT:MobileTemp:MIN:%6.11f\\n";
my $err=RRDs::error;
if ($err) {print "problem generating the graph: $err\n";}
print "Done!\n"
Vänta lite nu. Kan någon också se till so howto guiden uppdateras på hemsidan också och inte bara här på forumet.CirruZZ skrev:Sorry uppmärksamt av dig, det är ändrat nu..oJsan skrev:Måste nog tyvärr meddela att det fortfarande är fel för MAX och MIN, där står det fortfarande 5760 (medan det för AVERAGE står 576).