#!/bin/sh rrdtool graph "$graph.tmp" \ \ --imgformat PNG \ \ --width "$width" \ --height "$height" \ \ --start end-1d \ --end now \ \ --title 'outdoor temperature' \ --vertical-label '°C' \ \ --units-exponent 0 \ --units-length "$units_length" \ \ --slope-mode \ --interlaced \ --alt-y-grid \ \ "DEF:temp=$rrd:temp:AVERAGE" \ "DEF:temp_cf_min=$rrd:temp:MIN" \ "DEF:temp_cf_max_=$rrd:temp:MAX" \ \ 'CDEF:temp_cf_max=temp_cf_max_,-1,POP' \ \ 'VDEF:temp_min=temp_cf_min,MINIMUM' \ 'VDEF:temp_max=temp_cf_max,MAXIMUM' \ 'VDEF:temp_avg=temp,AVERAGE' \ 'VDEF:temp_last=temp,LAST' \ \ 'CDEF:temp_pos=temp,0,GT,temp,UNKN,IF' \ 'CDEF:temp_neg=temp,0,LE,temp,UNKN,IF' \ \ 'COMMENT:\s' \ 'COMMENT:\s' \ 'COMMENT:\s' \ 'COMMENT: Min Max Avg Last\n' \ 'COMMENT:\s' \ \ "LINE$line_weight:temp_pos#$today_pos" \ "LINE$line_weight:temp_neg#$today_neg" \ \ 'GPRINT:temp_min:%6.1lf' \ 'GPRINT:temp_max:%6.1lf' \ 'GPRINT:temp_avg:%6.1lf' \ 'GPRINT:temp_last:%6.1lf\n' \ \ "COMMENT: `date '+%F %H\:%M\:%S'`" \ \ > /dev/null && \ \ mv "$graph.tmp" "$graph" || \ exit 1