summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal LUÇI <eri@pfsense.org>2014-12-01 09:43:34 +0100
committerErmal LUÇI <eri@pfsense.org>2014-12-01 09:43:34 +0100
commit02b81e84d4395a331ea9bf8cff06d02236fb469d (patch)
tree61c90e87ab7ea30fde777edcb3ec57bc3c5d776c
parent64cda11e8175bf2fba34d52da6173d8acc6d0959 (diff)
downloadpfsense-02b81e84d4395a331ea9bf8cff06d02236fb469d.zip
pfsense-02b81e84d4395a331ea9bf8cff06d02236fb469d.tar.gz
Ticket #4053, manually merge improvements on rrd backup handling.
-rwxr-xr-xetc/rc.backup_rrd.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/etc/rc.backup_rrd.sh b/etc/rc.backup_rrd.sh
index 0ae89fe..408068a 100755
--- a/etc/rc.backup_rrd.sh
+++ b/etc/rc.backup_rrd.sh
@@ -6,12 +6,22 @@
# 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
- cd / && tar -czf "${CF_CONF_PATH}"/rrd.tgz -C / "${RRDDBPATH#/}"/*.xml
- rm "${RRDDBPATH}"/*.xml
+ 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
OpenPOWER on IntegriCloud