I am using sh(1) shell script to generate RRDTool for day, week, month and year. My question is, how to make this code more effective without repeating the same code? I tried it like this but always get errors, use trailing escape character etc:
NEWVAR="-a PNG -v "Interrupts/s" -h 130 -w 576 \
--watermark "`hostname`:`date "+%H:%M:%S - %d/%m/%Y"`" --font TITLE:15: \
--font LEGEND:7: --font UNIT:7: --font AXIS:5: -c CANVAS#000000 -c BACK#D8D8D8 \
DEF:DI="$RRDFDI":DI:AVERAGE \
CDEF:DIx=DI,8000,LT,DI,UNKN,IF \
AREA:DIx#FFDD44:"" \
LINE1.2:DIx#31B404:"Device Interrupts" \
GPRINT:DIx:MIN:"Min\:%6.0lf" \
GPRINT:DIx:AVERAGE:"Avg\:%6.0lf" \
GPRINT:DIx:MAX:"Max\:%6.0lf" \
GPRINT:DIx:LAST:"Cur\:%6.0lf\l""
$RRDBIN graph $NEWVAR -t "Device Interrupts Days Statistic (Interrupts)" --start -1d
$RRDBIN graph $NEWVAR -t "Device Interrupts Weeks Statistic (Interrupts)" --start -1w
$RRDBIN graph $NEWVAR -t "Device Interrupts Months Statistic (Interrupts)" --start -1m
$RRDBIN graph $NEWVAR -t "Device Interrupts Years Statistic (Interrupts)" --start -1y
Thank in advance!