fadwa salam wrote: >the problem is ,when I do the subtraction of this period to the >present timestamp does not work . > >$rrdtool fetch power.rrd AVERAGE -s 1h > >end=$(date +%s) >time=$2 =1h >let "start=($end-$time)" > >ERROR: start time: unparsable trailing text: '...h' > start time: There should be number after '-'
Assuming you are using Bash, then use the shell arithmetic to do a subtraction like this : start=$(( $end - $time )) But, and this case up recently, your start and end times must be an exact integral multiple of the resolution period you want. So if you want 5 minute resolution data, then your start and end times must be an integral multiple of 300s. So (again in Bash) : end=`date +%s` time=3600 period=300 end=$(( ( ${end} / ${period} ) * ${period} )) time=$(( ( ${time} / ${period} ) * ${period} )) start=$(( ${end} - ${time} )) -- Simon Hobson Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed author Gladys Hobson. Novels - poetry - short stories - ideal as Christmas stocking fillers. Some available as e-books. _______________________________________________ rrd-users mailing list rrd-users@lists.oetiker.ch https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users