Project

General

Profile

Download (784 Bytes) Statistics
| Branch: | Tag: | Revision:
1 ef68d19c jim-p
#!/bin/sh
2
3 8bdb6879 Darren Embry
: ${RRDDBPATH:=/var/db/rrd}
4
: ${CF_CONF_PATH:=/cf/conf}
5
6 ef68d19c jim-p
# Save the rrd databases to the config path.
7 8bdb6879 Darren Embry
if [ -d "${RRDDBPATH}" ]; then
8
	[ -z "$NO_REMOUNT" ] && /etc/rc.conf_mount_rw
9 c1819b48 Ermal LUÇI
	[ -f "${CF_CONF_PATH}/rrd.tgz" ] && /bin/rm -f "${CF_CONF_PATH}"/rrd.tgz
10 e173dd74 Phil Davis
11 8676899f Phil Davis
	tgzlist=""
12
13 8bdb6879 Darren Embry
	for rrdfile in "${RRDDBPATH}"/*.rrd ; do
14
		xmlfile="${rrdfile%.rrd}.xml"
15 8676899f Phil Davis
		tgzfile="${rrdfile%.rrd}.tgz"
16 8bdb6879 Darren Embry
		/usr/bin/nice -n20 /usr/local/bin/rrdtool dump "$rrdfile" "$xmlfile"
17 8676899f Phil Davis
		cd / && /usr/bin/tar -czf "${tgzfile}" -C / "${RRDDBPATH#/}"/*.xml
18 c1819b48 Ermal LUÇI
		/bin/rm -f "${RRDDBPATH}"/*.xml
19 8676899f Phil Davis
		tgzlist="${tgzlist} @${tgzfile}"
20 8bdb6879 Darren Embry
	done
21 8676899f Phil Davis
	if [ -n "${tgzlist}" ]; then
22
		cd / && /usr/bin/tar -czf "${CF_CONF_PATH}/rrd.tgz" ${tgzlist}
23
		/bin/rm -f "${RRDDBPATH}"/*.tgz
24 c1819b48 Ermal LUÇI
	fi
25 8bdb6879 Darren Embry
	[ -z "$NO_REMOUNT" ] && /etc/rc.conf_mount_ro
26 e9b0bcf7 Ermal
fi