blob: c14ffc714c441f4f4f68d63a14e5ff9e84b67081 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/bin/sh
: ${RRDDBPATH:=/var/db/rrd}
: ${CF_CONF_PATH:=/cf/conf}
# Save the rrd databases to the config path.
if [ -d "${RRDDBPATH}" ]; then
[ -z "$NO_REMOUNT" ] && /etc/rc.conf_mount_rw
[ -f "${CF_CONF_PATH}/rrd.tgz" ] && /bin/rm -f "${CF_CONF_PATH}"/rrd.tgz
tgzlist=""
for rrdfile in "${RRDDBPATH}"/*.rrd ; do
xmlfile="${rrdfile%.rrd}.xml"
tgzfile="${rrdfile%.rrd}.tgz"
/usr/bin/nice -n20 /usr/local/bin/rrdtool dump "$rrdfile" "$xmlfile"
cd / && /usr/bin/tar -czf "${tgzfile}" -C / "${RRDDBPATH#/}"/*.xml
/bin/rm -f "${RRDDBPATH}"/*.xml
tgzlist="${tgzlist} @${tgzfile}"
done
if [ -n "${tgzlist}" ]; then
cd / && /usr/bin/tar -czf "${CF_CONF_PATH}/rrd.tgz" ${tgzlist}
/bin/rm -f "${RRDDBPATH}"/*.tgz
fi
[ -z "$NO_REMOUNT" ] && /etc/rc.conf_mount_ro
fi
|