Kod: Markera allt
>> data.txt
Kod: Markera allt
PRINT:W:LAST:"%0.2lf%sW" \
> /mnt/web/txt/energinu.txt \
Kod: Markera allt
rrdtool graph test.png \
--start -24h --end now \
DEF:e=rrd.db:outside_temp:AVERAGE PRINT:e:AVERAGE:"tempertur\: %0.2lf%sW"|tail -n +2>test.txt
Kod: Markera allt
PRINT:W:LAST:"%0.2lf%sW"|tail -n +2>/mnt/web/txt/energinu.txt \
Kod: Markera allt
PRINT:W:LAST:"%0.2lf%sW" \
PRINT:X:LAST:"%0.2lf%sW" \
PRINT:Y:LAST:"%0.2lf%sW" \
Kod: Markera allt
tail: cannot open `PRINT:X:LAST:%0.2lf%sW' for reading: No such file or directory
tail: cannot open `PRINT:Y:LAST:%0.2lf%sW' for reading: No such file or director
Kod: Markera allt
cat fil.txt|sed '2!d'>fil1.txt
cat fil.txt|sed '3!d'>fil2.txt
cat fil.txt|sed '4!d'>fil3.txt
Hur skriptar jag för att få ut en textfil med sista avlästa värdet?#!/usr/bin/perl
use RRDs;
my $cur_time = time();
my $start_time = $cur_time - 21600; # set end time to 24 hours ago
RRDs::graph "/mnt/www/graph_utetemp_6h.png",
"--start= $start_time",
"--end= $cur_time",
"--title= xxx - ute - senaste 6 timmarna",
"--watermark=xxx",
"--height= 150",
"--width= 800",
"--vertical-label= °C",
"--alt-autoscale",
"--alt-y-grid",
"--slope-mode",
"DEF:UteTemp=/mnt/rrddata/Ute_Temp.rrd:UteTemp:AVERAGE",
"DEF:UteTempmax=/mnt/rrddata/Ute_Temp.rrd:UteTemp:MAX",
"COMMENT:\t\tNu Medel Max Min\\n",
"HRULE:0#0000FF",
"LINE1:UteTemp#00F:Ute\t",
# "AREA:UteTemp#EEE",
"GPRINT:UteTemp:LAST:%6.1lf",
"GPRINT:UteTemp:AVERAGE:%6.1lf",
"GPRINT:UteTemp:MAX:%6.1lf",
"GPRINT:UteTemp:MIN:%6.1lf\\n";
my $err=RRDs::error;
if ($err) {print "problem generating the graph: $err\n";}
print "Done!\n"
Kod: Markera allt
rrdtool lastupdate