[Nelug] Auto Backup

Andrew Hatch andrew.hatch at bluespace.com
Thu Sep 18 10:13:02 UTC 2003


I'm looking at performing a remote backup of a set of files located at
various places on a RedHat 7.3 filesystem.  I'd like this to happen
automatically, and keep 2 or 3 generations of backups and for the backups to
happen daily.  The situation is slightly more complicated in that the
machine I'm backing up from is in a secure area, and the backups should be
transferred offsite.  Here's a pic:

[A]<--ssh-->[B]<--ssh-->[C]

** [A] cannot address [C] directly.  Machines can only communicate via ssh
(and therefore scp also)

1. Files I want to backup live on A.
2. I want to copy them to C.
3. I need to go via B, for firewalling reasons.

My current thought is to do the following:

1. Write a script on A that will use scp to copy the necessary files into a
date-stamped directory on B.
2. Use cron to run the script at, say, 10pm every night.
3. Write a script on B that will scp over to C in a similar fasion, and
delete the files from B.
4. Have some mechanism of knowing that step (1) and (2) are successful and
have completed before executing the script in (3).
5. Encrypt the backup (gpg)
6. Store the backups in appropriately time-stamped directories on C
7. Delete backups that are more than 2 or 3 days old.

So, I'm looking for a bit of advice :-)  Firstly, is there a more optimal
way of doing this (assume I'm restricted to ssh access between machines, and
I can't change firewall rules) and secondly, I'm quite new to cron - anybody
able to help me out with scheduling a script to run at a set time every
night?  Thirdly, what is the best mechanism to use to determine if (1) and
(2) were successful?

Thanks in advance!

Andrew.





More information about the Nelug mailing list