Merge branch 'master' of git://github.com/thornomad/dt-s3-backup

This commit is contained in:
Mario Santagiuliana 2010-04-04 10:58:37 +02:00
commit 3a52bf0374
3 changed files with 58 additions and 33 deletions

View file

@ -1,38 +1,41 @@
Version Four (marionline) 0.4 Version Four (03/13/10)
* Add --list-files to view in the standart-output files stored in my archive ===========================
* Modification on --restore: if I provide a path to --restore option I don't want to answare a confermation question too
Version Four (0.4)
* Moved the source code to github * Moved the source code to github
* Added command line --restore to path (rather than script specific) * Add --list-files to view in the standart-output files stored in my archive [mariononline]
* Added --restore-file option * Added ECHO command to troublshoot the code when needed
* Added command line --restore to path & removed RESTORE variable [mariononline]
* Added --restore-file option [mariononline]
* Changed --backup-this-script to --backup-scrip * Changed --backup-this-script to --backup-scrip
* Added README to --backup-script * Added README to --backup-script
* Force use of --backup option (no accidently running the script) * Force use of --backup option (no accidently running the script)
* Added help text to the command line script itself [mariononline]
* Script without options shows --help and current directory settings * Script without options shows --help and current directory settings
* Removed the RESTORE variable from the script (command line now) * Script checks to make sure you have put some variables in before it runs [mariononline]
* Removed --test option (can't remember what it is for) * A number of other minor changes
Version Three (01/31/09) Version Three (01/31/09)
========================
1. Added comment to explain why folks need to use s3+ and not s3: for Amazon buckets * Added comment to explain why folks need to use 's3+' and not 's3:' for Amazon buckets
2. Used "unset" to remove the variables at end of the script * Used "unset" to remove the variables at end of the script
3. Fixed a problem when the backup folder on S3 was nested inside another bucket * Fixed a problem when the backup folder on S3 was nested inside another bucket
4. Changed the PASSPHRASE field to default to the actual passphrase, so one can easily backup the entire script and not have to worry about the passphrase. * Changed the PASSPHRASE field to default to the actual passphrase, so one can easily backup the entire script and not have to worry about the passphrase.
5. Added --backup-this-script option which will turn the script and the secret key into an encrypted tarball that can be kept somewhere safe for easy restores if the machine goes down. * Added --backup-this-script option which will turn the script and the secret key into an encrypted tarball that can be kept somewhere safe for easy restores if the machine goes down.
6. Cleaned up the get_file_size function so it wouldn't run when it wasn't supposed to. * Cleaned up the get_file_size function so it wouldn't run when it wasn't supposed to.
Version Two (12/03/08) Version Two (12/03/08)
======================
1. added GPL license * added GPL license
2. changed the cleanup feature to automatically force a full backup after (n) number of days as well as automatically cleanup after (n) number of days * changed the cleanup feature to automatically force a full backup after (n) number of days as well as automatically cleanup after (n) number of days
3. added option to force cleanup after (n) number of full backups (rather than by days) * added option to force cleanup after (n) number of full backups (rather than by days)
4. option to changed log file ownership * option to changed log file ownership
5. runtime checks for installed required software and write permissions on log directory * runtime checks for installed required software and write permissions on log directory
6. fixed formatting of logfile to be a little more consistent * fixed formatting of logfile to be a little more consistent
7. setup everything in clever functions * setup everything in clever functions
Version One (11/24/08) Version One (11/24/08)
======================
1. Initial release. * Initial release.

24
README
View file

@ -20,14 +20,23 @@ http://github.com/thornomad/dt-s3-backup
BEFORE YOU START BEFORE YOU START
================ ================
This is a bash script that requires user configuration. Instructions are in This script requires user configuration. Instructions are in
the file itself and should be self-explanatory. Be sure to replace all the the file itself and should be self-explanatory. Be sure to replace all the
*foobar* values with your real ones. Almost every value needs to be *foobar* values with your real ones. Almost every value needs to be
configured. configured in someway.
After the script is configured, you can move it to /usr/local/sbin/ or wherever You can use multiple copies of the script with different settings for different
you please and run it from there. A cron job is always nice. Be sure to make backup scenarios. It is designed to run as a cron job and will log information
the script executable (chmod +x) before you hit the gas. to a text file (including remote file sizes, if you have s3cmd installed). Be
sure to make the script executable (chmod +x) before you hit the gas.
REQUIREMENTS
============
* duplicity
* gpg
* Amazon S3
* s3cmd (optional)
COMMON USAGE EXAMPLES COMMON USAGE EXAMPLES
===================== =====================
@ -38,6 +47,9 @@ COMMON USAGE EXAMPLES
* Run an incremental backup: * Run an incremental backup:
$ dt-s3-backup.sh --backup $ dt-s3-backup.sh --backup
* Force a one-off full backup:
$ dt-s3-backup.sh --full
* Restore your entire backup: * Restore your entire backup:
$ dt-s3-backup.sh --restore $ dt-s3-backup.sh --restore
You will be prompted for a restore directory You will be prompted for a restore directory
@ -61,6 +73,8 @@ COMMON USAGE EXAMPLES
* Verify the backup * Verify the backup
$ dt-s3-backup.sh --verify $ dt-s3-backup.sh --verify
* Backup the script and gpg key (for safekeeping)
$ dt-s3-backup.sh --backup-script
NEXT VERSION WISH LIST NEXT VERSION WISH LIST
====================== ======================

View file

@ -100,8 +100,13 @@ LOG_FILE="duplicity-`date +%Y-%m-%d-%M`.txt"
LOG_FILE_OWNER="foobar_user_name:foobar_user_name" LOG_FILE_OWNER="foobar_user_name:foobar_user_name"
VERBOSITY="-v3" VERBOSITY="-v3"
# END OF USER EDITS # TROUBLESHOOTING: If you are having any problems running this script it is
# helpful to see the command output that is being generated to determine if the
# script is causing a problem or if it is an issue with duplicity (or your
# setup). Simply uncomment the ECHO line below and the commands will be
# printed to the logfile. This way, you can see if the problem is with the
# script or with duplicity.
#ECHO=$(which echo)
############################################################## ##############################################################
# Script Happens Below This Line - Shouldn't Require Editing # # Script Happens Below This Line - Shouldn't Require Editing #
@ -198,7 +203,7 @@ include_exclude()
duplicity_cleanup() duplicity_cleanup()
{ {
echo "-----------[ Duplicity Cleanup ]-----------" >> ${LOGFILE} echo "-----------[ Duplicity Cleanup ]-----------" >> ${LOGFILE}
${DUPLICITY} ${CLEAN_UP_TYPE} ${CLEAN_UP_VARIABLE} --force \ ${ECHO} ${DUPLICITY} ${CLEAN_UP_TYPE} ${CLEAN_UP_VARIABLE} --force \
--encrypt-key=${GPG_KEY} \ --encrypt-key=${GPG_KEY} \
--sign-key=${GPG_KEY} \ --sign-key=${GPG_KEY} \
${DEST} >> ${LOGFILE} ${DEST} >> ${LOGFILE}
@ -207,7 +212,7 @@ duplicity_cleanup()
duplicity_backup() duplicity_backup()
{ {
${DUPLICITY} ${OPTION} ${VERBOSITY} ${STATIC_OPTIONS} \ ${ECHO} ${DUPLICITY} ${OPTION} ${VERBOSITY} ${STATIC_OPTIONS} \
--encrypt-key=${GPG_KEY} \ --encrypt-key=${GPG_KEY} \
--sign-key=${GPG_KEY} \ --sign-key=${GPG_KEY} \
${EXCLUDE} \ ${EXCLUDE} \
@ -414,9 +419,12 @@ fi
echo -e "-------- END DT-S3-BACKUP SCRIPT --------\n" >> ${LOGFILE} echo -e "-------- END DT-S3-BACKUP SCRIPT --------\n" >> ${LOGFILE}
if [ ${ECHO} ]; then
echo "TEST RUN ONLY: Check the logfile for command output."
fi
unset AWS_ACCESS_KEY_ID unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY unset AWS_SECRET_ACCESS_KEY
unset PASSPHRASE unset PASSPHRASE
# vim: set tabstop=2 shiftwidth=2 sts=2 autoindent smartindent: # vim: set tabstop=2 shiftwidth=2 sts=2 autoindent smartindent:
# EOF