[Novalug] A Backup Script

James Ewing Cottrell, III jecottrell3@comcast.net
Thu Jun 11 11:51:44 EDT 2015


Yes, my script is based on the technique that rsnapshot uses.

But the tradeoff is: Is it easier to simply Implement My Own Thing or Learn Someone Else's?

And do I need the Full Feature Set?

It took me about half an hour to code that up, mostly dealing with the fussiness of --link-dest.

JIM

----- Original Message -----
From: covici@ccs.covici.com
To: "James Ewing Cottrell, III" <jecottrell3@comcast.net>
Cc: "NoVA LUG" <novalug@firemountain.net>
Sent: Thursday, June 11, 2015 10:09:46 AM
Subject: Re: [Novalug] A Backup Script

Maybe rsnapshot would work for you and has more features.

James Ewing Cottrell, III via Novalug <novalug@firemountain.net> wrote:

> I've been talking about this for awhile, and I finally got around to writing it.
> 
> usage: /back/up [ HOST ]
> 
> Backs up selected filesystems from HOST (or localhost if not specified) for the
> past month. If a file doesn't change from day to day, it is hard-linked instead
> of being copied. Files are kept in /back/$HOST/$DAY where DAY is {01..31}. Uses
> a symlink named "last" to point to the previous backup.
> 
> TODO: specify different FS by HOST
> TODO: optionally remove some days if space needed.
> TODO: hardlink between different hosts
> TODO: Suggestions?
> 
> I just ran this on a local host and a remote host,
> so I thought I'd post it while it still works.
> 
> JIM
> 
> #! /bin/sh -x
> 
> HOST=${1:-$(hostname)}
> SIZE=${2:-99G}
> TOP=/back/$HOST
> TODAY=$(date +%d)
> 
> if test -d $TOP
> then    LAST=$(readlink $TOP/last)
> else    for LAST in {01..31}; do mkdir -p $TOP/$LAST; done
> fi
> 
> cd $TOP
> for FS in / /dev /home/jcottrell /var
> do
>         mkdir -p $TODAY$FS
>         rsync -WHvaxz --link-dest=$PWD/$LAST$FS/ $HOST:$FS/ $PWD/$TODAY$FS/ --delete --max-size=$SIZE
> done
> 
> rm -f last
> ln -s $TODAY last
> **********************************************************************
> The Novalug mailing list is hosted by firemountain.net.
> 
> To unsubscribe or change delivery options:
> http://www.firemountain.net/mailman/listinfo/novalug

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com



More information about the Novalug mailing list