[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Backup rotation scripts
Hi,
On OpenBSD machines I tend to have something like the script below,
which keeps a week of backups, in /etc/daily.local
next_part "Tarsnap backup:"
/usr/local/bin/tarsnap \
--quiet \
--keyfile /var/tarsnap/tarsnap.key \
--cachedir /var/tarsnap/cache \
-cf var_backups@$(/bin/date -u +'%Y-%m-%dT%H:%M:%SZ') \
/var/backups \
/etc/hostname.*
# only keep the 7 most recent archives, deleting the rest
archivelist=$(/usr/local/bin/tarsnap --keyfile
/var/tarsnap/tarsnap.key --cachedir /var/tarsnap/cache --list-a|grep
var_backups@|sort -r|tail -n +8)
if [[ ! -z $archivelist ]]
then
deletionlist=$(echo "$archivelist"|xargs -I {} echo "-f {} ")
/usr/local/bin/tarsnap \
--quiet \
--keyfile /var/tarsnap/tarsnap.key \
--cachedir /var/tarsnap/cache \
-d $deletionlist
fi
Then I might add some extra paths to /etc/changelist so they’re
covered by the automatic backup to /var/backups. Those files will end
up in tarsnap too.
Cheers,
Mark
On 12 December 2014 at 12:03, Michael W. Lucas
<mwlucas@michaelwlucas.com> wrote:
> Hi folks,
>
> Some context here: I'm writing a small book about Tarsnap, and am
> trying to recommend things that are both best practice and that people
> are actually doing out in the real world. Colin has kindly offered me
> the contents of his brain, but he has a different perspective on
> Tarsnap than the users do.
>
> An Internet search for "tarsnap backup rotation scripts" brings up a
> lot of stuff. The problem with the Internet, of course, is that the
> mere presence of such a script doesn't mean that it's well-supported,
> works outside the author's environemnt, or that third parties are
> actually using it.
>
> So: what are you folks using to rotate your backups? Would you
> recommend it to other people?
>
> Any insight appreciated!
>
> Thanks,
> ==ml
>
> PS: Book details, such as they are, at
> http://blather.michaelwlucas.com/archives/2257
>
> --
> Michael W. Lucas - mwlucas@michaelwlucas.com, Twitter @mwlauthor
> http://www.MichaelWLucas.com/, http://blather.MichaelWLucas.com/