[Box Backup] Backup the backup

E.W. Peter Jalajas boxbackup@fluffy.co.uk
Fri, 20 Oct 2006 20:42:35 -0700 (PDT)


For everyone's review and comment...  :^)   I haven't yet tested
whether this remote backup backup is really useable...

First, I set up a fairly normal user "rsync1" on both boxes, and did
the normal ssh keys setup so I didn't need passwords.  

As rsync1 on the primary store, I have the following slightly redacted
crontab and script:

rsync1@brick:~$ crontab -e
# m h  dom mon dow   command
6 */4 * * * /home/rsync1/cron/rsync-ts4-backups
MAILTO=supportx@tebucosafe-junk.com

where 

rsync1@brick:~$ cat /home/rsync1/cron/rsync-ts4-backups
#!/bin/sh
#if [[ `ps -ef | grep rsync1-ts4-rsync | grep -v "grep
rsync1-ts4-rsync" |  wc -l` -lt 1 ]]
#First fix the accounts, just in case, per Ben Summers.
#Oops, can't do it because rsync1 is not in sudoers list.
#   Set it to run hourly as some sudoer's cron job
#for x in ` cat /usr/local/bin/accountlist | cut  -f1 ` ; do sudo
bbstoreaccounts check ${x} fix ; done
#Now backup the backup to a remote server
#some tracking info...
date ; id ; uname -a ; pwd
#make sure it's not running already or still...
if [[ `ps -ef | grep "/usr/bin/rsync.*host.myoffsitebackupdomain.com" |
grep -v grep > /dev/null ; echo $? ` -ne "0" ]]
then
  RSYNC=/usr/bin/rsync
  SSH=/usr/bin/ssh
  KEY=/home/rsync1/cron/ts3-rsync-key
  RUSER=rsync1
  RHOST=host.myoffsitebackupdomain.com
  #RPATH=/home/rsync1/test
  #RPATH=/media/bu_ts3
  RPATH=/bu
  #     LPATH needs trailing slash
  #LPATH=/home/rsync1/Examples/
  LPATH=/media/raid/bu2/

  #   --bwlimit=KBPS          limit I/O bandwidth; KBytes per second

  #$RSYNC -azvu --delete --stats  -e "$SSH -o StrictHostKeyChecking=no
-p 99999 -i $KEY" $RUSER@$RHOST:$RPATH $LPATH
  #Main one:
  $RSYNC -azvu --delete --stats --bwlimit=60 --exclude=write.lock -e
"$SSH -o StrictHostKeyChecking=no -p 2222 -i $KEY" $LPATH
$RUSER@$RHOST:$RPATH
  #No verbose:
  #$RSYNC -azu --delete --stats --bwlimit=60 -e "$SSH -o
StrictHostKeyChecking=no -p 99999 -i $KEY" $LPATH $RUSER@$RHOST:$RPATH
  # No bwlimit:
  #$RSYNC -azvu --delete --stats -e "$SSH -o StrictHostKeyChecking=no
-p 99999 -i $KEY" $LPATH $RUSER@$RHOST:$RPATH
fi
#how long did it take...
date
rsync1@brick:~$

--- Ben Summers <ben@fluffy.co.uk> wrote:

> 
> On 20 Oct 2006, at 10:18, Simon Lundström wrote:
> 
> > This has probably been covered before but I could not find anything
>  
> > about it in the mailing archives with my search keywords.
> >
> > I want to backup the backups that box backup creates, what could be
>  
> > the solutions? I need to have at least two offsite backups of the  
> > central backup storage.
> >
> > Backing up the RAID-file is one, but certainly isn't the best since
>  
> > this will be hot-backup and the server cannot be stopped.
> >
> > Restoring the files onto the server with bbackupquery and then  
> > backing up them into another server works but is a mess since I  
> > have to have all users keys on that server which is insecure.
> 
> You should find some discussions in the archives regarding the best  
> way of using rsync to do this backup -- that's the keyword you  
> probably didn't think of using in your searches. :-)
> 
> Ben
> 
> 
> 
> 
> 
> _______________________________________________
> boxbackup mailing list
> boxbackup@fluffy.co.uk
> http://lists.warhead.org.uk/mailman/listinfo/boxbackup
>