Skip to content

Commit

Permalink
Ticket #4053, manually merge improvements on rrd backup handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ermal LUÇI committed Dec 1, 2014
1 parent 64cda11 commit 02b81e8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions etc/rc.backup_rrd.sh
Expand Up @@ -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

0 comments on commit 02b81e8

Please sign in to comment.