#!/bin/bash

if [ "$1" == "" ]
then
        echo $"Usage: $0 <sensor_id>"
        exit 1
fi

cd /opt/tempberrypi/rrds

# create database if not exists
[ -f $1.rrd ] || {
/usr/bin/rrdtool create $1.rrd \
--start now --step 120 \
DS:temp1:GAUGE:240:-100:3000 \
RRA:AVERAGE:0.5:1:12 \
RRA:AVERAGE:0.5:1:288 \
RRA:AVERAGE:0.5:12:168 \
RRA:AVERAGE:0.5:12:720 \
RRA:AVERAGE:0.5:288:365 \
RRA:MIN:0.5:1:600 \
RRA:MIN:0.5:6:700 \
RRA:MIN:0.5:24:775 \
RRA:MIN:0.5:144:1500 \
RRA:MIN:0.5:288:2000 \
RRA:MAX:0.5:1:60 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:144:1500 \
RRA:MAX:0.5:288:2000 
}

cd /opt/tempberrypi/www

