rc.backup_rrd 373 Bytes
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1 2 3
#!/bin/sh

: ${RRDDBPATH:=/var/db/rrd}
4
: ${CF_CONF_PATH:=/conf}
Ad Schellevis's avatar
Ad Schellevis committed
5 6 7 8 9

# Save the rrd databases to the config path.
if [ -d "${RRDDBPATH}" ]; then
	for rrdfile in "${RRDDBPATH}"/*.rrd ; do
		xmlfile="${rrdfile%.rrd}.xml"
10
		/usr/local/bin/rrdtool dump "$rrdfile" "$xmlfile"
Ad Schellevis's avatar
Ad Schellevis committed
11 12 13 14
	done
	cd / && tar -czf "${CF_CONF_PATH}"/rrd.tgz -C / "${RRDDBPATH#/}"/*.xml
	rm "${RRDDBPATH}"/*.xml
fi