allows me to manage the daily/weekly interval in a more direct fashion.
Let me give an example. I was used to saving 35 days of daily backups,
each Friday was a weekly, and the third or fourth working day following
the month end was monthly. In an accounting environment where backing up
data just prior or just after a monthly update is a much more important
interval to capture than the forth weekly.
And only keeping the last seven dailies is too restrictive.
OK, my home system isn't that exotic. I cycle my removable REV drive on
a weekly basis. I wanted to have 6 dailies and a weekly, with the weekly
being the daily backup on the last day the drive was cycled, not the
daily from six days ago.
I wrote this script as a proof of concept. this way I'm using an
unmodified rsnapshot 1.20 my way. If you think this would be a good
option to add to rsnapshot, I would be glad to test it.
Thanks, BobH
---<snip>---
#!/bin/bash
# /etc/cron.often/rsnapshot.script
arg1=${1:-0} # default to zero (daily) if undefined
# 0 -Daily
# 1 -Weekly
rootdir=/mnt/rev
#-- Test for mounted media ---------------------------------+
if [ ! -d /mnt/rev/lost+found ]; then
mount /mnt/rev
rc=$?
sleep 2
if [ $rc -ne 0 ];then
echo "Drive /mnt/rev NOT mounted!"
exit
fi
fi
#-- Invoke rsnapshot on a daily basis ----------------------+
# Change logic so that Weekly.0 is generated by:
# mv daily.0 weekly.0
# ln -s weekly.0 daily.0
echo "<----------------------------------------------------------->"
echo "Rsnapshot.script starting... $(date "+%F %T") "
echo ""
nice /usr/bin/rsnapshot daily
if [ ${arg1} -eq 1 ]; then
#-- Roll weeklies ------------------------------------------+
if [ -d ${rootdir}/weekly.2 ]; then
echo "rm -fr ${rootdir}/weekly.2 "
echo "$(date "+[%d/%a/%Y:%H:%M:%S]") \
rm -fr ${rootdir}/weekly.2 " >> \
${rootdir}/rsnapshot.log
rm -fr ${rootdir}/weekly.2
fi
if [ -d ${rootdir}/weekly.1 ]; then
echo "mv ${rootdir}/weekly.1 ${rootdir}/weekly.2 "
echo "$(date "+[%d/%a/%Y:%H:%M:%S]") \
mv ${rootdir}/weekly.1 ${rootdir}/weekly.2 " >> \
${rootdir}/rsnapshot.log
mv ${rootdir}/weekly.1 ${rootdir}/weekly.2
fi
if [ -d ${rootdir}/weekly.0 ]; then
echo "mv ${rootdir}/weekly.0 ${rootdir}/weekly.1 "
echo "$(date "+[%d/%a/%Y:%H:%M:%S]") \
mv ${rootdir}/weekly.0 ${rootdir}/weekly.1 " >> \
${rootdir}/rsnapshot.log
mv ${rootdir}/weekly.0 ${rootdir}/weekly.1
fi
#-- Create weekly.0 ----------------------------------------+
echo "mv ${rootdir}/daily.0 ${rootdir}/weekly.0 "
mv ${rootdir}/daily.0 ${rootdir}/weekly.0
echo "ln -s ${rootdir}/weekly.0 ${rootdir}/daily.0 "
ln -s ${rootdir}/weekly.0 ${rootdir}/daily.0
fi
#-- Move log file ------------------------------------------+
mv /mnt/rev/rsnapshot.log /mnt/rev/daily.0/
touch /mnt/rev/rsnapshot.log
echo "<----------------------------------------------------------->"
echo "Rsnapshot.script finished... $(date "+%F %T") "
echo ""
/bin/sync;/bin/sync
umount /mnt/rev 2>&1 > /dev/null
echo "<----------------------------------------------------------->"
echo "/mnt/rev Umounted... $(date "+%F %T") "
/usr/bin/logger -i -p user.notice -t rsnapshot "/mnt/rev/ unmounted"
#-- Add comment to log -------------------------------------+
mount /mnt/rev
/bin/df -h /mnt/rev
echo "$(date "+[%d/%a/%Y:%H:%M:%S]") /mnt/rev unmounted" >> \
/mnt/rev/daily.0/rsnapshot.log
umount /mnt/rev 2>&1 > /dev/null
#-- Test for Saturday --------------------------------------+
if [ `date +%w ` -eq 6 ]; then
mail -s "REMOVE Rev Disk $(date "+%F %T") " bobh
fi
# RLH
--
Bob Hillegas <bobhillegas < at > houston.rr.com>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
rsnapshot-discuss mailing list
rsnapshot-discuss < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss
