diff options
author | Ermal LUÇI <eri@pfsense.org> | 2014-12-01 09:43:34 +0100 |
---|---|---|
committer | Ermal LUÇI <eri@pfsense.org> | 2014-12-01 09:43:34 +0100 |
commit | 02b81e84d4395a331ea9bf8cff06d02236fb469d (patch) | |
tree | 61c90e87ab7ea30fde777edcb3ec57bc3c5d776c | |
parent | 64cda11e8175bf2fba34d52da6173d8acc6d0959 (diff) | |
download | pfsense-02b81e84d4395a331ea9bf8cff06d02236fb469d.zip pfsense-02b81e84d4395a331ea9bf8cff06d02236fb469d.tar.gz |
Ticket #4053, manually merge improvements on rrd backup handling.
-rwxr-xr-x | etc/rc.backup_rrd.sh | 14 |
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 |