Re: Archival of backups
Steven Clark <[email protected]> Wed, 19 Jan 2005 21:10:50 -0500
| Newsgroups | gmane.comp.sysutils.backup.sarab |
|---|---|
| Message-ID | <[email protected]> |
--Boundary_(ID_ZmMyRmGXSjFk/GbrOl3Gug) Content-type: text/plain; CHARSET=US-ASCII Content-transfer-encoding: 7BIT Here's the patch for this. -Steve On Mon, 2005-01-17 at 09:03 -0700, Tristan Rhodes wrote: > Steven, > > I like your idea for archiving backups to DVDs. Another user suggested a similar process, except > that idea was never followed through (probably my fault). > > If you are willing, send me a patch. I think it will be easy to implement into SaraB. > > I appreciate your time and look forward to hearing more from you. > > Tristan > > Steven Clark wrote: > > First off, Tristan thanks for reply, glad you liked it. ;) > > > > I was wondering if people that use sarab, how they implement archival of > > backups ( if they do at all ;) ). Currently I am using the > > Grandfather/Son backup scheme but I would also like to have the week1 > > backups taken offsite. > > > > Has anyone come up with a way to more or less automate this process, I > > am burning the backup to dvd+rw disks which suits me. Any interest in > > having this automated or at least maybe "prepared" for the buring > > process? > > > > If there even a need/want to incorporate this feature? > > > > Here is an idea to implement this > > > > In rotation.schedule have a keyword that can be placed beside an exiting > > line. This tells sarab that this backup should be archived as well. > > > > In sarab.conf add a new keyword such as ARCHIVE_SCRIPT. Once the sarab > > completes a backup with the keyword in rotation.schedule it calls the > > script listed in ARCHIVE_SCRIPT with parameters such as backup location > > and basename. > > > > With this at least the archival process can happen, is flexible > > according to how the user wants to handle backup archival, and keeps the > > sarab.sh script as clean as possible. > > > > Any thoughts? > > > > -Steve > > > > > > > > ------------------------------------------------------- > > The SF.Net email is sponsored by: Beat the post-holiday blues > > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > > _______________________________________________ > > SaraB-discuss mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/sarab-discuss > > > --Boundary_(ID_ZmMyRmGXSjFk/GbrOl3Gug) Content-type: text/x-patch; name=archive-script.patch; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: attachment; filename=archive-script.patch Index: sarab.sh =================================================================== RCS file: /var/db/cvs/sarab/sarab.sh,v retrieving revision 1.3 diff -u -r1.3 sarab.sh --- sarab.sh 18 Jan 2005 00:11:36 -0000 1.3 +++ sarab.sh 18 Jan 2005 01:59:46 -0000 @@ -163,11 +163,47 @@ verbose "Number of fields: $NUM_FIELDS" ## If more than two fields, the data in rotation.schedule is not in the right format -if [ "$NUM_FIELDS" -gt "2" ]; then +if [ "$NUM_FIELDS" -gt "3" ]; then echo "Error: Each line in rotation.schedule can only have one or two fields." exit 1 fi +## Test to see if the user wants us to call the archive script on this backup +if [ "$NUM_FIELDS" -gt "1" ]; then + LAST_WORD=$(echo $CURRENT_LINE | cut -f $NUM_FIELDS -d" ") + if [ "$LAST_WORD" = "archive" ]; then + CALL_ARCHIVE_SCRIPT="1" + + # Lets verify that the archive script to call actually exists... + if [ -z $ARCHIVE_SCRIPT ]; then + echo "Error: The archive script variable was not set in the config file" + exit 1 + fi + + if [ ! -f $ARCHIVE_SCRIPT ]; then + echo "Error: $ARCHIVE_SCRIPT does not exist" + exit 1 + fi + + if [ ! -x $ARCHIVE_SCRIPT ]; then + echo "Error: $ARCHIVE_SCRIPT is not executable" + exit 1 + fi + + # Decrement our $NUM_FIELDS var for the other functions to work + let NUM_FIELDS=$NUM_FIELDS-1 + + # Remove the archive from the line + CURRENT_LINE="$(echo $CURRENT_LINE | awk -F' archive' '{ print $1 }')" + + echo "Calling archive script: yes" + else + echo "Calling archive script: no" + fi +else + echo "Calling archive script: no" +fi + ## Two fields means this is a diffential/incremental backup, one field means this is a full backup if [ "$NUM_FIELDS" = "2" ]; then # First field is the current archive @@ -346,6 +382,22 @@ exit 1 fi +# Calling the archive script if asked too +if [ ! -z "$CALL_ARCHIVE_SCRIPT" ]; then + echo + echo "Calling archive script... " + verbose + verbose "$ARCHIVE_SCRIPT $DESTINATION/$CURRENT_ARCHIVE $BASENAME" + $ARCHIVE_SCRIPT $DESTINATION/$CURRENT_ARCHIVE $BASENAME + + if [ "$?" != 0 ]; then + echo + echo "Error: $ARCHIVE_SCRIPT exited with a non-zero status" + else + echo "$ARCHIVE_SCRIPT exited ok" + fi +fi + ## Record finish time echo "Backup completed at $(date)" END_TIME=$(date +'%s') Index: etc/rotation.schedule.README =================================================================== RCS file: /var/db/cvs/sarab/etc/rotation.schedule.README,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 rotation.schedule.README --- etc/rotation.schedule.README 18 Jan 2005 00:08:40 -0000 1.1.1.1 +++ etc/rotation.schedule.README 18 Jan 2005 01:05:07 -0000 @@ -33,6 +33,8 @@ archive names. +7. Appending the keyword archive to a line will cause SaraB to call the script designated in ARCHIVE_SCRIPT in sarab.conf + See below for examples. Ex. 1) Normal (full) backups. @@ -54,3 +56,19 @@ incr-backup2 incr-backup1 # Another incremental, based on the previous incremental incr-backup3 incr-backup2 # Incremental backups only record changes since the previous incremental incr-backup4 incr-backup3 # Incrementals save the most space, but require more steps to restore from + +Ex. 4) Incremental backups. Note: "full-backup" is a normal (full) backup which the full-backup being archived + +full-backup archive # Normal full-backup and archive script called +incr-backup1 full-backup # First incremental, based on the full-backup +incr-backup2 incr-backup1 # Another incremental, based on the previous incremental +incr-backup3 incr-backup2 # Incremental backups only record changes since the previous incremental +incr-backup4 incr-backup3 # Incrementals save the most space, but require more steps to restore from + +Ex. 5) Incremental backups. With the archival script called after every iteration + +full-backup archive # Normal full-backup +incr-backup1 full-backup archive # First incremental, based on the full-backup +incr-backup2 incr-backup1 archive # Another incremental, based on the previous incremental +incr-backup3 incr-backup2 archive # Incremental backups only record changes since the previous incremental +incr-backup4 incr-backup3 archive # Incrementals save the most space, but require more steps to restore from Index: etc/sarab.conf =================================================================== RCS file: /var/db/cvs/sarab/etc/sarab.conf,v retrieving revision 1.2 diff -u -r1.2 sarab.conf --- etc/sarab.conf 18 Jan 2005 00:11:36 -0000 1.2 +++ etc/sarab.conf 18 Jan 2005 02:13:12 -0000 @@ -44,6 +44,10 @@ # Default="yes" COPY_DAR="yes" +# Script to call after backups that are designated with the archive +# keyword in rotation.schedule +ARCHIVE_SCRIPT="" + # Test each archive for errors immediately after creating it? Uses a 16-bit CRC check. # SaraB will display a notification and exit if any errors are found. If an error is found, # the corrupted backup will be located in the working directory, and the rotation.schedule --Boundary_(ID_ZmMyRmGXSjFk/GbrOl3Gug)-- ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl