Project

General

Profile

Download (690 Bytes) Statistics
| Branch: | Tag: | Revision:
1
#!/bin/sh
2

    
3
: ${RRDDBPATH:=/var/db/rrd}
4
: ${CF_CONF_PATH:=/cf/conf}
5

    
6
# Save the rrd databases to the config path.
7
if [ -d "${RRDDBPATH}" ]; then
8
	[ -f "${CF_CONF_PATH}/rrd.tgz" ] && /bin/rm -f "${CF_CONF_PATH}"/rrd.tgz
9

    
10
	tgzlist=""
11

    
12
	for rrdfile in "${RRDDBPATH}"/*.rrd ; do
13
		xmlfile="${rrdfile%.rrd}.xml"
14
		tgzfile="${rrdfile%.rrd}.tgz"
15
		/usr/bin/nice -n20 /usr/local/bin/rrdtool dump "$rrdfile" "$xmlfile"
16
		cd / && /usr/bin/tar -czf "${tgzfile}" -C / "${RRDDBPATH#/}"/*.xml
17
		/bin/rm -f "${RRDDBPATH}"/*.xml
18
		tgzlist="${tgzlist} @${tgzfile}"
19
	done
20
	if [ -n "${tgzlist}" ]; then
21
		cd / && /usr/bin/tar -czf "${CF_CONF_PATH}/rrd.tgz" ${tgzlist}
22
		/bin/rm -f "${RRDDBPATH}"/*.tgz
23
	fi
24
fi
25

    
(16-16/77)