Project

General

Profile

Download (754 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 550a7f4b Renato Botelho
		/usr/bin/tar -czf "${tgzfile}" -C / ${xmlfile#/}
18
		/bin/rm -f ${xmlfile}
19 8676899f Phil Davis
		tgzlist="${tgzlist} @${tgzfile}"
20 8bdb6879 Darren Embry
	done
21 550a7f4b Renato Botelho
22 8676899f Phil Davis
	if [ -n "${tgzlist}" ]; then
23 550a7f4b Renato Botelho
		/usr/bin/tar -czf "${CF_CONF_PATH}/rrd.tgz" -C / ${tgzlist}
24 8676899f Phil Davis
		/bin/rm -f "${RRDDBPATH}"/*.tgz
25 c1819b48 Ermal LUÇI
	fi
26 8bdb6879 Darren Embry
	[ -z "$NO_REMOUNT" ] && /etc/rc.conf_mount_ro
27 e9b0bcf7 Ermal
fi