Skip to content

Bash script for automated backups with duplicity and Amazon's S3 online storage

License

Notifications You must be signed in to change notification settings

orkaa/dt-s3-backup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ABOUT THIS SCRIPT
=================

This bash script was designed to automate and simplify the remote backup
process of duplicity on Amazon S3 primarily. Other backup destinations are
possible. After your script is configured, you can easily backup, restore,
verify and clean (either via cron or manually) your data without having to
remember lots of different command options and passphrases.

Most importantly, you can easily backup the script and your gpg key in a
convenient passphrase-encrypted file.  This comes in in handy if/when your
machine ever does go belly up.

Optionally, you can set up an email address where the log file will be sent,
which is useful when the script is used via cron.

This version is a rewriting of the code originally written by Damon Timm,
including many patches that have been brought to the original scripts by
various forks on Github.

Latest version of the code available at:
http://github.com/zertrin/duplicity-backup

Merge requests are welcome :)

More information about this script available at:
http://zertrin.org/duplicity-backup.html

The original version of the code is availabe at:
http://github.com/theterran/dt-s3-backup

BEFORE YOU START
================

This script requires user configuration.  Instructions are in
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
configured in someway.

You can use multiple copies of the script with different settings for different
backup scenarios.  It is designed to run as a cron job and will log information
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 (optional)
* s3cmd (optional)
* mailx (optional)

CONFIGURATION
=============

The configuration takes place directly in the script and is documented there.

You can optionnaly specifiy a custom config file in the CONFIG parameter at the
very beginning. Any parameter specified in this custom config file will
override thoses specified in the script.

COMMON USAGE EXAMPLES
=====================

* View help:
    $ duplicity-backup.sh

* Run an incremental backup:
    $ duplicity-backup.sh --backup

* Force a one-off full backup:
    $ duplicity-backup.sh --full

* Restore your entire backup:
    $ duplicity-backup.sh --restore
    You will be prompted for a restore directory

    $ duplicity-backup.sh --restore /home/user/restore-folder
    You can also provide a restore folder on the command line.

* Restore a specific file in the backup:
    $ duplicity-backup.sh --restore-file
    You will be prompted for a file to restore to the current directory

    $ duplicity-backup.sh --restore-file img/mom.jpg
    Restores the file img/mom.jpg to the current directory

    $ duplicity-backup.sh --restore-file img/mom.jpg /home/user/i-love-mom.jpg
    Restores the file img/mom.jpg to /home/user/i-love-mom.jpg

* List files in the remote archive
    $ duplicity-backup.sh --list-current-files

* Verify the backup
    $ duplicity-backup.sh --verify

* Backup the script and gpg key (for safekeeping)
    $ duplicity-backup.sh --backup-script

TROUBLESHOOTING
===============

This script attempts to simplify the task of running a duplicity command; if you
are having any problems with the script the first step is to determine if the
script is generating an incorrect command or if duplicity itself is
causing your error.

To see exactly what is happening when you run duplicity-backup, head to the bottom
of the user configuration portion of the script and uncomment the `ECHO=$(which
echo)` variable.  This will stop the script from running and will, instead,
output the generated command into your log file. You can then check to see if
what is being generated is causing an error or if it is duplicity causing you
woe.

NEXT VERSION WISH LIST
======================

* --restore-dir option
* restore files from a specific time period
* support multiple MTAs for the email alert feature

Thanks to Mario Santagiuliana and Razvan for their help.

About

Bash script for automated backups with duplicity and Amazon's S3 online storage

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%