Compare commits

..

No commits in common. "dev" and "0.8.3" have entirely different histories.
dev ... 0.8.3

8 changed files with 500 additions and 1650 deletions

View file

@ -1,13 +0,0 @@
language: bash
# Use container-based infrastructure for quicker build start-up
sudo: false
before_script:
- shellcheck --version
script:
- shellcheck -e SC2034 duplicity-backup.sh duplicity-backup.conf.example
matrix:
fast_finish: true

View file

@ -1,5 +1,4 @@
Damon Timm <damontimm@gmail.com> <http://blog.damontimm.com> Damon Timm <damontimm@gmail.com> <http://blog.damontimm.com>
Mario Santagiuliana <mario@marionline.it> <http://www.marionline.it> Mario Santagiuliana <mario@marionline.it> <http://www.marionline.it>
Razvan Marescu <rmarescu+github@gmail.com> <https://github.com/rmarescu> Razvan Marescu <rmarescu+github@gmail.com> <http://github.com/rmarescu>
Marc Gallet <zertrin@gmail.com> <https://github.com/zertrin> Marc Gallet <gmarc34@gmail.com> <http://github.com/zertrin>
All commit contributors https://github.com/zertrin/duplicity-backup/graphs/contributors

View file

@ -1,68 +1,3 @@
vX.X.X (unreleased)
===================
v1.6.0 (2018-05-22)
===================
* Add support for Dropbox backend (by xmatthias)
* Fix issue #177: bug in `--cleanup` action (thanks smcgrat)
v1.5.0 (2018-01-15)
===================
* Add support for B2 backend (by harrim4n)
v1.4.3 (2017-10-30)
===================
* Add support for Telegram notifications (by GerardRibas)
v1.4.2 (2017-10-30)
===================
* Remove VERSION file and hardcode it directly in the script. Fix issue #164 (thanks regelga)
v1.4.1 (2017-10-04)
===================
* Show program versions in output.
v1.4.0 (2017-09-24)
===================
* Add version check of duplicity to handle deprecation of --include-globbing-filelist
* Bugfixes
v1.3.0 (2016-10-23)
===================
* Fix GPG error when backing up the script if no specific keyring is set up.
* Attempt to fix issue #145 by adding a `GPG_OPTIONS` parameter.
* Add `-h` / `--help` option to print usage and don't send email or notification when printing usage only
* Rename repository from 'duplicity-backup' to 'duplicity-backup.sh'.
v1.2 (2016-09-10)
=================
* Changed: big rework of logging handling. Now done through I/O-redirection of file descriptors 1 to 5.
* Fix: Add case for s-nail when using mailx.
* Fix: Always exclude /proc from Source Disk Use Information.
* Fix issue #140: Add --no-show-photos to --gpg-options.
* Fix "line 89: 4: Bad file descriptor" when printing usage without config set up.
v1.1 (2016-09-03)
===================
* Fix and improve handling of INCLIST and EXCLIST (issue #128)
* Fix shellcheck error SC2166
* Fix shellcheck error SC2128
* Fix shellcheck SC2153 and SC1090
* Restart versionning and keeping a changelog
* Add option "--version" or "-V" to show version information about this script and duplicity
0.9.x (2013-01-14 to 2016-08-31)
================================
Versionning and keeping a changelog up to date has been neglected between 2013-01-14 and 2016-08-31.
There were no official 0.9.x release, but an automatically generated list of changes that affected
`duplicity-backup.sh` or `duplicity-backup.conf.example` is available in the file `CHANGELOG_0.9.x.md`.
0.8.3 (02 January 2013)
======================
* FreeBSD portability (du, mail, & shebang) [barofsoap]
* Fix issue #30 "-s (collection-status) option not writing anything to log file"
0.8.2 (01 November 2012) 0.8.2 (01 November 2012)
======================== ========================
* Handle --time option for restoration and file-listing * Handle --time option for restoration and file-listing
@ -78,10 +13,8 @@ There were no official 0.9.x release, but an automatically generated list of cha
0.8 (05 August 2012) 0.8 (05 August 2012)
=================== ===================
* Improved argument parsing. Now the script is insensitive to the order of appearance of the options and handles * Improved argument parsing. Now the script is insensitive to the order of appearance of the options and handles correctly optional options parameters
correctly optional options parameters * Re-added possibility to specify the config file on the command line, which is now the recommended way to do (facilitating script updates)
* Re-added possibility to specify the config file on the command line, which is now the recommended way to do
(facilitating script updates)
* Added dry-run command line option (-n or --dry-run) * Added dry-run command line option (-n or --dry-run)
* Added many short versions of long options (-b, -f, -v, -l, -s) * Added many short versions of long options (-b, -f, -v, -l, -s)
* Fix "unary operator expected warning" in some rare cases * Fix "unary operator expected warning" in some rare cases
@ -101,14 +34,12 @@ Inclusion of two patches written by [shamer] + modified config file management.
* Added option to use ssmtp to send mail [shamer] * Added option to use ssmtp to send mail [shamer]
* Added lock file to prevent running multiple instances simultaneously [shamer] * Added lock file to prevent running multiple instances simultaneously [shamer]
* Modified config file management (no more specified on the command line, must be specified as an parameter at the * Modified config file management (no more specified on the command line, must be specified as an parameter at the beginning of the script)
beginning of the script)
* Fixed bad check_variables() behaviour when not using Amazon S3 storage backend without commenting AWS API keys * Fixed bad check_variables() behaviour when not using Amazon S3 storage backend without commenting AWS API keys
0.6 Version Six (4 May 2012) 0.6 Version Six (4 May 2012)
============================ ============================
This is a rework of the script to include some github patches that were brought to the original script in order to make This is a rework of the script to include some github patches that were brought to the original script in order to make the script more generic than only Amazon S3 oriented and fix a few issues.
the script more generic than only Amazon S3 oriented and fix a few issues.
* Added ability not to encrypt the backup [orkaa] * Added ability not to encrypt the backup [orkaa]
* Added ability to use backup destination locations other than Amazon S3 [orkaa] * Added ability to use backup destination locations other than Amazon S3 [orkaa]
@ -149,18 +80,15 @@ Version Three (01/31/09)
* 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
* Used "unset" to remove the variables at end of the script * Used "unset" to remove the variables at end of the script
* 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
* Changed the PASSPHRASE field to default to the actual passphrase, so one can easily backup the entire script and * 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.
not have to worry about the passphrase. * 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.
* 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)
====================== ======================
* added GPL license * added GPL license
* changed the cleanup feature to automatically force a full backup after (n) number of days as well as automatically * 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
cleanup after (n) number of days
* 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)
* option to changed log file ownership * option to changed log file ownership
* runtime checks for installed required software and write permissions on log directory * runtime checks for installed required software and write permissions on log directory

View file

@ -1,107 +0,0 @@
Between version 0.10.0 and 0.8.3, versionning had been neglected and no CHANGELOG entry was kept up to date.
Here is an export from `git log` for all changes that affected `duplicity-backup.sh` or `duplicity-backup.conf.example` between 2013-01-14 and 2016-08-31.
```
2016-08-31 23:03:09 +0200 - 73adf5d - Fixes related to new warnings coming from the new version of shellcheck
2016-08-31 17:09:28 -0300 - 6ce9a64 - Wrong identation
2016-08-31 16:36:29 -0300 - 4f96d72 - Send notification if stale lock is detected
2016-08-31 15:26:12 -0300 - 465ae13 - Add IFTTT notification service
2016-08-31 15:13:34 -0300 - c9bd2a4 - Add IFTTT notification service
2016-07-13 18:23:27 +0200 - 2f07d0e - Adding -e, --cleanup flag...
2016-07-03 01:07:08 +0200 - 1604d02 - Support mailx from mailutils
2016-06-15 13:38:18 +0200 - 7a84fbd - Fix for issue #128
2016-04-29 15:31:56 +0200 - dcdc081 - changed my mind about where to place NOTIFICATION_SERVICE
2016-04-29 15:27:40 +0200 - b90289d - minor comment changes to notifications
2016-04-28 15:58:49 -0400 - 0501d23 - fixed error
2016-04-28 21:28:54 +0200 - 6dc6d19 - Restore the functionality to specify a custom mail script
2016-04-23 14:15:09 -0400 - 3ffde78 - Adding Pushover notifications
2016-04-06 11:05:19 -0400 - a719668 - added -r flag to bash read to allow backslashes in GPG passphrases
2016-04-01 23:21:19 +0200 - fad4bd2 - Full rework of email handling
2016-03-28 23:47:39 +0200 - f3f4ddc - rework code for email and notifications (more DRY)
2016-03-28 23:21:02 +0200 - 74f637d - Typo
2016-03-25 20:40:46 +0100 - bcd64c1 - first iteration after activation of Travis-CI
2016-03-25 20:00:39 +0100 - 6c63877 - one last cleaning in the conf file with shellcheck
2016-03-25 19:47:29 +0100 - 3797960 - massive cleaning with shellcheck: from 5 errors and 200 warnings to zero
2016-03-24 21:12:17 +0100 - 454d278 - minor changes to the pull request before merging
2016-03-24 20:59:42 +0100 - 471cc9f - minor changes to the pull request before merging
2016-03-16 18:01:49 +0530 - 491b045 - Add storage class option for AWS S3 to specify storage class to be used
2016-02-26 14:56:31 +0800 - 3eabe0d - Add config sample for Slack notifications
2016-02-26 14:54:34 +0800 - fcfa9ac - Add Slack incoming webhook notifications support
2016-02-26 14:44:46 +0800 - 4fca444 - Better comment
2016-01-27 10:50:15 -0500 - ff1e827 - Adding support for custom mail scripts.
2016-01-23 15:12:03 +1100 - 931fe9e - added ftps and ftpes to list of possible destinations
2015-10-19 13:59:34 +0800 - 423a1d3 - Fix typo
2015-10-10 13:31:12 +0200 - 3a48d5a - Fix bug #106 (unary operator expected)
2015-10-08 10:15:56 +0200 - e5d5785 - also send email on cleanup failure + replace introduced tabs with spaces
2015-09-02 10:17:14 +0200 - 8985d9c - - added EMAIL_FAILURE_ONLY option to send e-mails only if there was an error while doing backup - added HOSTNAME option to inform in e-mail report for which server is this report for - e-mail subject is rewrited now to know if backup was OK or not
2015-08-17 14:58:00 -0500 - 689eb23 - add more backslashes to unweildy awk script
2015-07-29 21:56:53 +0200 - 498ac97 - Rework of duplicity-backup.conf.example, no functionality changes
2015-07-29 15:38:48 +0200 - 5bdb816 - Add OpenStack Swift support
2015-07-05 20:08:51 +0200 - 0dfa26a - change mode of script to 755
2015-06-24 13:33:06 +0200 - 0644d76 - Make tar stdin/stdout explicit in backup function
2015-05-21 09:09:10 +0200 - 19951b7 - Fix issue #94
2015-05-18 18:40:23 +0200 - a69eeaa - Delete trailing spaces
2015-05-18 18:17:34 +0200 - 4be3671 - Fix bug #93 : make message about unsupported destination disk usage more explicit
2015-05-14 16:17:20 +0200 - 2be958e - Human readable size for Google Cloud
2015-05-14 16:16:56 +0200 - 01143b6 - Size GCS with gsutil
2015-05-14 14:16:59 +0200 - 8abfd40 - Google Cloud Storage support
2015-04-20 13:33:44 -0400 - 528cc41 - Move --exclude-device-files to beginning of EXCLUDE variable
2015-04-17 08:54:36 -0500 - c8d249d - removed perl dependancy
2015-04-13 17:13:08 -0500 - 20ded18 - Appending usage information to EMAIL_SUBJECT modified: duplicity-backup.sh
2015-04-10 15:26:28 -0500 - a749d24 - Add support for getting size of remote disk connected via ssh
2015-01-27 15:23:11 +0000 - e94732a - Add destination type to disk use report and make format consistent with source du report
2015-01-27 13:13:18 +0000 - 08cb675 - improve s3cmd not installed message, ie mention PATH
2015-01-26 19:20:44 +0000 - 3fcfb22 - add s3cmd config not found to dest disk use report
2015-01-23 19:12:57 +0000 - 92a3932 - unset ftp_password variable
2015-01-23 17:02:25 +0000 - 258e68c - copy whole array rather than one element
2015-01-23 16:25:51 +0000 - ea14212 - remove not on -z INCLIST check
2015-01-21 16:29:42 +0100 - 2e6e383 - Rework on the pull request to refactor the new code
2015-01-21 15:59:42 +0100 - b34c7a5 - Include the include/exclude globbing file in the backup tarball if present
2015-01-19 20:13:52 +0000 - 6f5b0dc - My typo in code comment - du not df
2015-01-19 19:08:23 +0000 - 01ec946 - Correct log reports of file size to disk use, plus some log file formatting cleanups
2015-01-19 18:36:11 +0000 - 646f8c4 - Excluded directories were no excluded from source disk usage report - quotes issue
2015-01-19 17:17:56 +0000 - 6ccf691 - Don't skip source disk use report when INCLIST unconfigured
2015-01-18 18:01:32 +0000 - bdcb1bf - Update example config with log dir creation info
2015-01-18 14:50:35 +0000 - d3c2102 - If we create the log dir chown it to log file owner
2014-12-05 09:39:05 +1100 - 59f2339 - add an option to set the tmpdir for duplicity to use.
2014-12-05 09:30:05 +1100 - 83b7ecd - doing a collection status and file list need to eval the command (like all the other commands already do) because if you have ssh options set in your config, it causes an error ("duplicity: error: no such option: -o")
2014-08-10 03:08:38 +0200 - 7b20db3 - fix: ensure a trailing slash in log dir name
2014-06-06 12:11:58 +0300 - 456f5cd - Add a note in configuration about escaping "$" in passphrase
2014-06-06 12:09:04 +0300 - 615a988 - Add Google Docs destination to configuration
2014-06-06 12:03:18 +0300 - a148ac8 - Fix typos, remove trailing whitespace
2014-04-16 15:05:23 +0200 - 1bde60d - Add REMOVE_LOGS_OLDER_THAN parameter to the config file
2014-03-30 14:44:31 -0400 - 9f5626b - Add option to remove old log files.
2014-03-30 14:44:17 -0400 - 36f87c7 - Only change log file ownership if necessary.
2014-03-30 14:43:53 -0400 - b20f7ab - Clarification when remote size unavailable.
2014-03-04 12:22:14 +0100 - 4f90cc7 - add support for DragonFly and OpenBSD
2014-02-05 16:59:34 +0100 - 3bfd78c - duplicity-backup.sh: Fix quotation issue
2014-01-06 17:24:51 -0500 - 2209955 - dont include --sign-key when restoring w/ hidden-enc key
2014-01-03 16:25:26 -0500 - 417d526 - only cleanup if CLEAN_UP_TYPE and CLEAN_UP_VARIABLE are defined
2014-01-03 15:26:26 -0500 - 1864e3a - added HIDE_KEY_ID and SECRET_KEYRING options
2014-01-02 16:16:23 +0200 - 07c1fd2 - Added the option to skip cleanup
2013-11-22 10:32:19 +0100 - 1bd7c26 - Fixes issue zertrin/duplicity-backup/issues/41 - conf revert
2013-11-22 10:29:07 +0100 - 7d83629 - Fixes issue zertrin/duplicity-backup/issues/41
2013-11-13 21:56:12 +0100 - 54f9aaf - Complete the half-done work of previous commit
2013-11-13 21:36:34 +0100 - 03ef054 - Add the --restore-dir synonym and update the documentation accordingly
2013-11-13 20:08:34 +0100 - e9af0ab - Some little modifications and additions in the doc of the config file
2013-11-13 19:55:47 +0100 - dd05ff6 - Add support for mail sending via msmtp
2013-11-13 19:36:15 +0100 - 5c99b4c - fixed variable name (cherry picked from commit 19c80a83a2819bdac73dfe4bc08e270205a9a666)
2013-11-11 00:06:31 +0000 - 22e3904 - Renamed the --dry-run option to --debug.Created proper duplicity --dry-run command (recommended -v8, info verbosity level)
2013-08-12 11:06:09 +0200 - c3aa58b - Small improvements to the fix of cippino before merge
2013-08-02 10:52:08 +0200 - 0275cb5 - Fixed INCLIST
2013-07-22 11:59:41 +0200 - dbf78cf - Better explanation of the FTP_PASSWORD variable based on official documentation
2013-07-22 10:20:29 +0200 - 63d38be - Add notes about the difference between "mailx" and "mail" commands
2013-07-22 10:11:31 +0200 - 68931e4 - Move the new section about remove-all-inc-of-but-n-full a bit lower in the config file.
2013-07-21 19:58:46 -0500 - 9b34c04 - Adds the option to use remove-all-inc-of-but-n-full to prune incrementals of backups with long history.
2013-07-09 11:52:03 -0300 - 582416f - A small contribution with a set a ftp variable to run on a script
2013-07-07 19:03:42 +0200 - 7275aaf - sendmail error
2013-07-03 09:21:20 +0200 - 31da9c8 - Sendmail as mail command
2013-05-14 22:12:27 -0500 - e636dd4 - Fix typos.
2013-03-31 01:24:26 +0100 - 89a78ed - Be a bit more specific about configuration problems
2013-03-31 01:21:43 +0100 - 7bb45ff - Let s3cmd have the correct bucket name when using s3 scheme
2013-03-23 00:14:23 +0100 - ee1b759 - Fix issue #38 : Multiple recipients
2013-01-29 14:32:05 +0100 - bc0fa15 - Fix for du --exclude-from and mail on OS X
2013-01-14 21:25:36 +0100 - 02fae5c - Update duplicity-backup.sh
2013-01-14 01:04:56 +0100 - 6df0902 - Fix issue #33 : Allow to specify the s3cmd configuration file
```

166
README Normal file
View file

@ -0,0 +1,166 @@
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
(FTP, SFTP, SCP, rsync, file...), i.e. any of duplicity's supported outputs.
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/projects/duplicity-backup/
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 config file
itself and should be self-explanatory. Please DO NOT edit the example config
file, but make a copy of it and edit this one. Be sure to replace all the
*foobar* values with your real ones. Almost every value needs to be configured
in someway.
You can use one copy 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
* which
* Amazon S3 (optional)
* s3cmd (optional)
* mailx (optional)
CONFIGURATION
=============
The configuration takes place in a separate config file and is documented there.
You want to copy duplicity-backup.conf.example to another place that suits your
needs (for example /etc/duplicity-backup.conf)
The script looks for its configuration by reading the config file specified by
the command line option -c or --config (see USAGE)
If no config file was given on the command line, the script will try to find the
file specified in the CONFIG parameter at the beggining of the script (defaults
to "duplicity-backup.conf" in the script's directory).
So be sure either:
- to specify the configuration file path on the command line [recommended]
- or to edit the CONFIG parameter in thescript to match the actual location of
your config file. [deprecated]
NOTE: to ease future updates of the script, you may prefer NOT to edit the
script at all and to specify systematically the path to your config file
on the command line with the -c or --config option.
USAGE
=====
duplicity-backup.sh [options]
Options:
-c, --config CONFIG_FILE specify the config file to use
-b, --backup runs an incremental backup
-f, --full forces a full backup
-v, --verify verifies the backup
--restore [PATH] restores the entire backup to [path]
--restore-file [FILE_TO_RESTORE] [DESTINATION]
restore a specific file
-l, --list-current-files lists the files currently backed up in the archive
-s, --collection-status show all the backup sets in the archive
-t, --time TIME specify the time from which to restore or list
files (duplicity time format)
--backup-script automatically backup the script and secret key to
the current working directory
-n, --dry-run perform a trial run with no changes made
COMMON USAGE EXAMPLES
=====================
* View help:
$ duplicity-backup.sh
* Run an incremental backup:
$ duplicity-backup.sh [-c config_file] --backup
* Force a one-off full backup:
$ duplicity-backup.sh [-c config_file] --full
* Restore your entire backup:
$ duplicity-backup.sh [-c config_file] --restore
You will be prompted for a restore directory
$ duplicity-backup.sh [-c config_file] --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 [-c config_file] --restore-file
You will be prompted for a file to restore to the current directory
$ duplicity-backup.sh [-c config_file] --restore-file img/mom.jpg
Restores the file img/mom.jpg to the current directory
$ duplicity-backup.sh [-c config_file] --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 [-c config_file] --list-current-files
* Verify the backup
$ duplicity-backup.sh [-c config_file] --verify
* Backup the script and gpg key (for safekeeping)
$ duplicity-backup.sh [-c config_file] --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, either pass the
option -n or --dry-run on the command line, or head to the bottom of the
configuration file 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
Thanks to Mario Santagiuliana and Razvan for their help.

281
README.md
View file

@ -1,281 +0,0 @@
[![Build Status](https://travis-ci.org/zertrin/duplicity-backup.sh.svg?branch=dev)](https://travis-ci.org/zertrin/duplicity-backup.sh)
# duplicity-backup.sh
This bash script was designed to automate and simplify the remote backup process of [duplicity](http://duplicity.nongnu.org/) on Amazon S3 primarily. Other backup destinations are possible (Google Cloud Storage, FTP, SFTP, SCP, rsync, file...), i.e. any of duplicity's supported outputs.
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](https://github.com/thornomad), including many patches that have been brought to the original scripts by various forks on Github. Thanks to all the contributors!
More information about this script is available at https://zertrin.org/projects/duplicity-backup/
The original version of the code is available at https://github.com/theterran/dt-s3-backup
## duplicity-backup.sh IS NOT duplicity
It is only a wrapper script for duplicity written in bash!
This means the following:
* You need to install AND configure duplicity BEFORE using duplicity-backup.sh
* [The official documentation of duplicity](http://duplicity.nongnu.org/duplicity.1.html) is relevant to duplicity-backup.sh too. Virtually any option supported by duplicity can be specified in the config file of duplicity-backup.sh. See the `STATIC_OPTIONS`, `CLEAN_UP_TYPE` and `CLEAN_UP_VARIABLE` parameters in particular.
* Before asking something about duplicity-backup.sh, ensure that your question isnt actually concerning duplicity ;) First, make sure you can perform a backup with duplicity without using this script. If you can't make the backup work with duplicity alone, the problem is probably concerning duplicity and not this script. If you manage to make a backup with duplicity alone but not with this script, then there is probably a problem with duplicity-backup.sh.
* In particular, to the question "_Does duplicity-backup.sh support the backend XXX_" (with XXX being for example Amazon Glacier), the answer is always the same: "_duplicity-backup.sh uses duplicity, so ask the developers of duplicity ;) Once it's in duplicity, it's automatically available to duplicity-backup.sh_"
## Contributing
The development version of the code is available at https://github.com/zertrin/duplicity-backup.sh in the `dev` branch. It is a bleeding-edge version with the latest changes that have not yet been tested a lot, but that's the best starting point to contribute.
Pull requests are welcome! However please **always use individual feature branches for each pull request**. I may not accept a pull request from a master or dev branch.
Here is how to do it:
Fork the repository first and then clone your fork on your machine:
git clone git@github.com:YOURNAME/duplicity-backup.sh.git duplicity-backup
cd duplicity-backup
Add a remote for the upstream repository:
git remote add upstream git@github.com:zertrin/duplicity-backup.sh.git
git fetch upstream
Create a new topic branch for the changes you want to make, based on the `dev` branch from upstream:
git checkout -b my-fix-1 upstream/dev
Make your changes, test them, commit them and push them to Github:
git push origin my-fix-1
Open a Pull request from `YOURNAME:my-fix-1` to `zertrin:dev`.
If you want to open another pull request for another change which is independent of the previous one, just create another topic branch based on master (`git checkout -b my-fix-2 upstream/dev`)
## Installation
### 1. Get the script
You can clone the repository (which makes it easy to get future updates):
git clone https://github.com/zertrin/duplicity-backup.sh.git duplicity-backup
If you prefer the stable (but old) version do:
git checkout stable
... or if you want the normal version, then:
git checkout master
... or if you like living on the edge (or need the latest bugfixes), you can stay at the development version which is automatically cloned.
Or just download the ZIP file:
| Version | Download link |
|---------------|-------------------------------------------------------------------|
| stable (old) | https://github.com/zertrin/duplicity-backup.sh/archive/stable.zip |
| normal | https://github.com/zertrin/duplicity-backup.sh/archive/master.zip |
| latest | https://github.com/zertrin/duplicity-backup.sh/archive/dev.zip |
### 2. Configure the script
This script requires user configuration. Instructions are in the config file itself and should be self-explanatory. You SHOULD NOT edit the example config file `duplicity-backup.conf.example`, but instead make a copy of it (for example to `/etc/duplicity-backup.conf`) and edit this one.
Be sure to replace all the *foobar* values with your real ones. Almost every value needs to be configured in someway.
The script looks for its configuration by reading the path to the config file specified by the command line option `-c` or `--config` (see [Usage](#usage))
If no config file was given on the command line, the script will try to find the file specified in the `CONFIG` parameter at the beginning of the script (default: `duplicity-backup.conf` in the script's directory).
So be sure to either:
* specify the configuration file path on the command line with the `-c` option **[recommended]**
* or to edit the `CONFIG` parameter in the script to match the actual location of your config file. **[deprecated]** _(will be removed in future versions of the script)_
NOTE: to ease future updates of the script, you may prefer NOT to edit the script at all and to specify systematically the path to your config file on the command line with the `-c` or `--config` option.
You can use one copy of the script and call it with different config file 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 use Amazon S3 and have `s3cmd` installed).
### Misc
Be sure to make the script executable if needed (`chmod +x`) before you hit the gas.
## Upgrade
### 1. Get the new version
If you got the script by cloning the repository, upgrading is easy:
git pull
else just download again the ZIP archive an extract it over the existing folder. (Don't forget to keep a backup of the previous folder to be able to rollback easily if needed)
### 2. Adapt the config file if needed
Then compare the example config file (`duplicity-backup.conf.example`) with your modified version (for example `/etc/duplicity-backup.conf`) and adapt your copy to reflect the changes in the example file.
There are many ways to do so, here are some examples (adapt the path to your actual files):
diff duplicity-backup.conf.example /etc/duplicity-backup.conf
vimdiff duplicity-backup.conf.example /etc/duplicity-backup.conf
## Dependencies
* [duplicity](http://duplicity.nongnu.org/)
* Basic utilities like: [bash](https://www.gnu.org/software/bash/), [which](http://unixhelp.ed.ac.uk/CGI/man-cgi?which), [find](https://www.gnu.org/software/findutils/) and [tee](http://linux.die.net/man/1/tee) (should already be available on most Linux systems)
* [gpg](https://www.gnupg.org/) *`optional`* (if using encryption)
* [mailx](http://linux.die.net/man/1/mailx) *`optional`* (if sending mail is activated in the script)
For the [Amazon S3](https://aws.amazon.com/s3/) storage backend *`optional`*
* [s3cmd](http://s3tools.org/s3cmd) *`optional`*
For the [Backblaze B2](https://www.backblaze.com/b2) storage backend *`optional`*
* [python-b2](https://pypi.python.org/pypi/b2) *`optional`*
For the [Google Cloud Storage](https://cloud.google.com/storage/) storage backend *`optional`*
* [boto](https://github.com/boto/boto) (may already have been installed with duplicity)
* [gsutil](https://cloud.google.com/storage/docs/gsutil) *`optional`*
## Usage
duplicity-backup.sh [options]
Options:
-c, --config CONFIG_FILE specify the config file to use
-b, --backup runs an incremental backup
-f, --full forces a full backup
-v, --verify verifies the backup
-e, --cleanup cleanup the backup (eg. broken sessions), by default using
duplicity --force flag, use --dry-run to actually log what
will be cleaned up without removing (see man duplicity
> ACTIONS > cleanup for details)
-l, --list-current-files lists the files currently backed up in the archive
-s, --collection-status show all the backup sets in the archive
--restore [PATH] restores the entire backup to [path]
--restore-file [FILE_TO_RESTORE] [DESTINATION]
restore a specific file
--restore-dir [DIR_TO_RESTORE] [DESTINATION]
restore a specific directory
-t, --time TIME specify the time from which to restore or list files
(see duplicity man page for the format)
--backup-script automatically backup the script and secret key(s) to
the current working directory
-n, --dry-run perform a trial run with no changes made
-d, --debug echo duplicity commands to logfile
-V, --version print version information about this script and duplicity
## Usage Examples
**View help:**
duplicity-backup.sh
**Run an incremental backup:**
duplicity-backup.sh [-c config_file] --backup
**Force a one-off full backup:**
duplicity-backup.sh [-c config_file] --full
**Restore your entire backup:**
# You will be prompted for a restore directory
duplicity-backup.sh [-c config_file] --restore
# You can also provide a restore folder on the command line.
duplicity-backup.sh [-c config_file] --restore /home/user/restore-folder
**Restore a specific file or directory in the backup:**
Note that the commands `--restore-file` and `--restore-dir` are equivalent.
# You will be prompted for a file to restore to the current directory
duplicity-backup.sh [-c config_file] --restore-file
# Restores the file img/mom.jpg to the current directory
duplicity-backup.sh [-c config_file] --restore-file img/mom.jpg
# Restores the file img/mom.jpg to /home/user/i-love-mom.jpg
duplicity-backup.sh [-c config_file] --restore-file img/mom.jpg /home/user/i-love-mom.jpg
# Restores the directory rel/dir/path to /target/restorepath
duplicity-backup.sh [-c config_file] --restore-dir rel/dir/path /target/restorepath
**List files in the remote archive**
duplicity-backup.sh [-c config_file] --list-current-files
**See the collection status (i.e. all the backup sets in the remote archive)**
duplicity-backup.sh [-c config_file] --collection-status
**Verify the backup**
duplicity-backup.sh [-c config_file] --verify
**Clean the backup**
duplicity-backup.sh [-c config_file] --cleanup
**Backup the script and gpg key in a encrypted tarfile (for safekeeping)**
duplicity-backup.sh [-c config_file] --backup-script
## Cron Usage Example (backup)
41 3 * * * /absolute/path/to/duplicity-backup.sh -c /etc/duplicity-backup.conf -b
## Cron Usage Example (cleanup)
41 4 * * 1 /absolute/path/to/duplicity-backup.sh -c /etc/duplicity-backup.conf -e
## Known issues
### GPG error if system locale is not english
If your system's locale is not english, an error can happen when duplicity is trying to encrypt the files with gpg. This problem concerns duplicity and has been reported upstream ([see bug report](https://bugs.launchpad.net/duplicity/+bug/510625)). A simple workaround is to set the following environement variable: `LANG=C`. For example: `LANG=C duplicity-backup.sh [-c config_file] ...` or in the cron `41 3 * * * LANG=C /absolute/path/to/duplicity-backup.sh -c /etc/duplicity-backup.conf -b`
### "/dev/fd/62: Operation not supported" errors on FreeBSD
See [issue #143](https://github.com/zertrin/duplicity-backup.sh/issues/143) for a fix.
## 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.sh, either pass the option `-d` or `--debug` on the command line, or head to the bottom of the configuration file 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.
You can also try the `-n` or `--dry-run` option. This will make duplicity to calculate what would be done, but does not perform any backend actions. Together with info verbosity level (-v8) duplicity will list all files that will be affected. This way you will know exactly which files will be backed up or restored.
## Wish List
* Backup to multiple destinations with one config file
* Show backup-ed files in today incremental backup email
###### Thanks to all the [contributors](https://github.com/zertrin/duplicity-backup.sh/graphs/contributors) for their help.

View file

@ -2,7 +2,7 @@
# #
# Copyright (c) 2008-2010 Damon Timm. # Copyright (c) 2008-2010 Damon Timm.
# Copyright (c) 2010 Mario Santagiuliana. # Copyright (c) 2010 Mario Santagiuliana.
# Copyright (c) 2012-2018 Marc Gallet. # Copyright (c) 2012 Marc Gallet.
# #
# This program is free software: you can redistribute it and/or modify it under # This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software # the terms of the GNU General Public License as published by the Free Software
@ -20,13 +20,10 @@
# MORE ABOUT THIS SCRIPT AVAILABLE IN THE README AND AT: # MORE ABOUT THIS SCRIPT AVAILABLE IN THE README AND AT:
# #
# http://zertrin.org/projects/duplicity-backup/ (for this version) # http://zertrin.org/projects/duplicity-backup/ (for this version)
# http://damontimm.com/code/dt-s3-backup (for the original program by Damon Timm) # http://damontimm.com/code/dt-s3-backup (for the original programi by Damon Timm)
# #
# Latest code available at: # Latest code available at:
# http://github.com/zertrin/duplicity-backup.sh # http://github.com/zertrin/duplicity-backup
#
# List of contributors:
# https://github.com/zertrin/duplicity-backup.sh/graphs/contributors
# #
# ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- #
@ -35,231 +32,20 @@
# ############################################# # #############################################
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# ! DO NOT edit this file! ! # ! DO NOT edit duplicity-backup.conf.example !
# ! (duplicity-backup.conf.example) !
# ! please copy it to anywhere you want ! # ! please copy it to anywhere you want !
# ! (typically duplicity-backup.conf) ! # ! (typically duplicity-backup.conf) !
# ! and edit that copy instead ! # ! and edit this file instead !
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# .............
# . WARNING .
# .............
#
# duplicity-backup.sh IS NOT duplicity!
#
# It is only a wrapper script for duplicity written in bash!
#
# This means the following:
#
# * You need to install and configure duplicity BEFORE using duplicity-backup.sh
#
# * The official documentation of duplicity (http://duplicity.nongnu.org/duplicity.1.html)
# is relevant to duplicity-backup.sh too. Virtually any option supported
# by duplicity can be specified in the config file of duplicity-backup.sh.
# See the `STATIC_OPTIONS`, `CLEAN_UP_TYPE` and `CLEAN_UP_VARIABLE` parameters in particular.
#
# * Before asking something about duplicity-backup.sh, ensure that your question
# isn't actually concerning duplicity ;)
# First, make sure you can perform a backup with duplicity without using this script.
# If you can't make the backup work with duplicity alone, the problem is probably
# concerning duplicity and not this script. If you manage to make a backup with duplicity
# alone but not with this script, then there is probably a problem with duplicity-backup.sh.
# ------------------------------------------------------------------------------
# BACKUP SOURCE INFORMATION
# ------------------------------------------------------------------------------
#
# The ROOT of your backup (where you want the backup to start);
# This can be / or somewhere else -- I use /home/ because all the
# directories that I want to backup start with /home/.
#
ROOT='/home'
# Set hostname for this duplicity instance, useful for e-mail reports
#
HOSTNAME=$(hostname -f)
# ------------------------------------------------------------------------------
# BACKUP DESTINATION INFORMATION
# ------------------------------------------------------------------------------
# In my case, I use Amazon S3 use this - so I made up a unique
# bucket name (you don't have to have one created, it will do it
# for you). If you don't want to use Amazon S3, you can backup
# to a file or any of duplicity's supported outputs.
#
# The s3+http scheme uses the default aws s3 hostname.
# Use s3://host/bucket/[backup-folder/] if you want to specify the host name.
# If using the s3://... scheme and you have s3cmd installed, be sure to change
# 's3.amazonaws.com' to the appropriate host in your .s3cfg file so that the
# remote file size check will work.
#DEST="s3://host/backup-bucket/backup-folder/"
DEST="s3+http://foobar-backup-bucket/backup-folder/"
# Other possible locations
# Be sure to check duplicity's man page to know how to use them
# (http://duplicity.nongnu.org/duplicity.1.html)
#
#DEST="gs://foobar-backup-bucket/backup-folder/"
#DEST="ftp://user[:password]@other.host[:port]/some_dir"
#DEST="ftps://user[:password]@other.host[:port]/some_dir"
#DEST="ftpes://user[:password]@other.host[:port]/some_dir"
#DEST="rsync://user@host.com[:port]//absolute_path"
#DEST="scp://user[:password]@other.host[:port]/[/]some_dir"
#DEST="sftp://user[:password]@other.host[:port]/[/]some_dir"
#DEST="file:///home/foobar_user_name/new-backup-test/"
#DEST="imap[s]://user[:password]@host.com[/from_address_prefix]"
#DEST="webdav[s]://user[:password]@other.host[:port]/some_dir"
#DEST="gdocs://foobar_google_account/some_dir"
#DEST="swift://foobar_swift_container/some_dir"
#DEST="dpbx:///foobar_swift_container/some_dir"
#DEST="b2://some_account_id[:some_application_key]@some_bucket_name/some_dir"
# ------------------------------------------------------------------------------
# DESTINATION BACKEND PASSWORD
# ------------------------------------------------------------------------------
# Instead of setting the password needed for the backup destination in the
# DEST url, you can supply it in the FTP_PASSWORD variable below, which is
# used by most, if not all backends, regardless of its name.
# Duplicity's official documentation states:
# "Supported by most backends which are password capable. More secure than
# setting it in the backend url (which might be readable in the operating
# systems process listing to other users on the same machine)."
#
#FTP_PASSWORD='password'
# ------------------------------------------------------------------------------
# AMAZON S3 INFORMATION # AMAZON S3 INFORMATION
# ------------------------------------------------------------------------------ # Comment out this lines if you're not using Amazon S3
# Uncomment these lines if you're using Amazon S3 AWS_ACCESS_KEY_ID="foobar_aws_key_id"
# AWS_SECRET_ACCESS_KEY="foobar_aws_access_key"
#AWS_ACCESS_KEY_ID="foobar_aws_key_id"
#AWS_SECRET_ACCESS_KEY="foobar_aws_access_key"
#
# SET STORAGE CLASS for AWS
# The default storage class is STANDARD STORAGE. You can comment this option if
# want to go with standard. The other storage options are --s3-use-ia and --s3-use-rrs.
# Note: --s3-use-ia option is supported only in duplicity version greater than 0.7.06
#
#STORAGECLASS="--s3-use-ia"
#
# S3CMD INFORMATION
# Most people don't need this, but in some cases
# you may want to specify a custom configuration file
# to pass to s3cmd. If so, set the S3CMD_CONF_FILE variable
# to the full path of this custom config file.
# Per default s3cmd uses ${HOME}/.s3cfg
#
#S3CMD_CONF_FILE='/path/to/your/s3cmd/conf/file'
# ------------------------------------------------------------------------------
# GOOGLE CLOUD STORAGE INFORMATION
# ------------------------------------------------------------------------------
# Uncomment these lines if you're using Google Cloud storage
#
#GS_ACCESS_KEY_ID="foobar_gcs_key_id"
#GS_SECRET_ACCESS_KEY="foobar_gcs_secret_id"
# ------------------------------------------------------------------------------
# OPENSTACK OBJECT STORAGE (SWIFT) INFORMATION
# ------------------------------------------------------------------------------
# Uncomment these lines if you're using OpenStack Object Storage (Swift)
#
#SWIFT_USERNAME="foobar_swift_tenant:foobar_swift_username"
#SWIFT_PASSWORD="foobar_swift_password"
#SWIFT_AUTHURL="foobar_swift_authurl"
#SWIFT_AUTHVERSION="2"
# ------------------------------------------------------------------------------
# DROPBOX INFORMATION
# ------------------------------------------------------------------------------
# Uncomment these lines if you're using Dropbox
#
#DPBX_ACCESS_TOKEN="foobar_dropbox_access_token"
# ------------------------------------------------------------------------------
# INCLUDE LIST OF DIRECTORIES
# ------------------------------------------------------------------------------
# Here is a list of directories to include; if you want to include
# everything that is in ROOT, leave this list empty.
#
# Here is an example with multiple locations:
#
#INCLIST=( '/home/*/Documents' \
# '/home/*/Projects' \
# '/home/*/logs' \
# '/home/www/mysql-backups' \
# )
#
# Simpler example with one location:
INCLIST=( '/home/foobar_user_name/Documents/' )
# ------------------------------------------------------------------------------
# EXCLUDE LIST OF DIRECTORIES
# ------------------------------------------------------------------------------
# Even though I am being specific about what I want to include,
# there is still a lot of stuff I don't need.
# If you don't want to exclude anything, leave this list empty.
#
# Here is an example with multiple locations:
#
#EXCLIST=( '/home/*/Trash' \
# '/home/*/Projects/Completed' \
# '/**.DS_Store' \
# '/**Icon?' \
# '/**.AppleDouble' \
# )
#
# If you don't want to exclude anything, use EXCLIST=()
#
# Simpler example with one location. Adapt it to your needs.
EXCLIST=( '/home/foobar_user_name/Documents/foobar-to-exclude' )
# ------------------------------------------------------------------------------
# INCLUDE GLOBBING FILELIST
# ------------------------------------------------------------------------------
# Instead of using the INCLIST/EXCLIST variable you can also define a special
# (text-)file where each line in the filelist will be interpreted as
# a globbing pattern. By using the '+' or '-' sign at the beginning of each line
# you are able to specify if the folder should be included or excluded.
#
# Example:
# + /dir/foo
# - /dir/foob*
# + /dir/*
#
# From the duplicity manual:
# Lines starting with "+" are interpreted as include directives[...]Similarly, lines starting with "-" exclude files even if they are found within an include filelist.
# For more examples or information refer to http://duplicity.nongnu.org/duplicity.1.html#sect10
#
#INCEXCFILE=/path/to/file
# ------------------------------------------------------------------------------
# EXCLUDE DEVICE FILES
# ------------------------------------------------------------------------------
# Exclude all device files. This can be useful for security/permissions reasons
# or if device files are not handled correctly.
#
#EXDEVICEFILES=1
# ------------------------------------------------------------------------------
# ENCRYPTION INFORMATION # ENCRYPTION INFORMATION
# ------------------------------------------------------------------------------
#
# Do you want your backup to be encrypted? yes/no # Do you want your backup to be encrypted? yes/no
# If yes, please make sure you specify either PASSPHRASE or GPG_ENC_KEY/GPG_SIGN_KEY # If yes, please make sure you specify either PASSPHRASE or GPG_ENC_KEY/GPG_SIGN_KEY
ENCRYPTION='yes' ENCRYPTION='yes'
# If you are NOT running this from a cron, comment this line out # If you are NOT running this from a cron, comment this line out
@ -268,198 +54,121 @@ ENCRYPTION='yes'
# (your backups will be encrypted with this password) or is used # (your backups will be encrypted with this password) or is used
# for the "GPG_SIGN_KEY" (see below). # for the "GPG_SIGN_KEY" (see below).
# Comment out if you aren't using encryption # Comment out if you aren't using encryption
# Note: if you have a ' in your passphrase, escape it accordingly. PASSPHRASE="foobar_gpg_passphrase"
PASSPHRASE='foobar_gpg_passphrase'
# Specify which GPG keys you would like to use (even if you have only one). # Specify which GPG keys you would like to use (even if you have only one).
# If you are running this from a cron, it is highly recommended to create separate # If you are running this from a cron, it is highly recommended to create separate
# signature and encryption keys, because you have to specify the password for the # signature and encryption keys, because you have to specify the password for the
# GPG_SIGN_KEY via the above PASSPHRASE variable # GPG_SIGN_KEY via the above PASSPHRASE variable
# (see http://www.debian-administration.org/articles/209#d0e109). # (see http://www.debian-administration.org/articles/209#d0e109).
# If you are not running the script from a cron, duplicity should prompt you for the # If you are not running the script from a cron, duplicity should prompt you for the
# GPG_SIGN_KEY password. # GPG_SIGN_KEY password.
# If you choose to use the same GPG key for encryption and signature, set it both # If you choose to use the same GPG key for encryption and signature, set it both
# in GPG_ENC_KEY and GPG_SIGN_KEY. # in GPG_ENC_KEY and GPG_SIGN_KEY.
# Comment out if you're using only PASSPHRASE (symmetric encryption) or not using # Comment out if you're using only PASSPHRASE (symmetric encryption) or not using
# encryption at all. # encryption at all.
GPG_ENC_KEY="foobar_gpg_key" GPG_ENC_KEY="foobar_gpg_key"
GPG_SIGN_KEY="foobar_gpg_key" GPG_SIGN_KEY="foobar_gpg_key"
# Do you want to hide the key id of the encrypted files? yes/no # BACKUP SOURCE INFORMATION
# It uses the gpg's --hidden-recipient command to obfuscate the owner of the backup. # The ROOT of your backup (where you want the backup to start);
# On restore, gpg will automatically try all available secret keys in order to # This can be / or somwhere else -- I use /home/ because all the
# decrypt the backup. See gpg(1) for more details. # directories start with /home/ that I want to backup.
ROOT="/home"
# BACKUP DESTINATION INFORMATION
# In my case, I use Amazon S3 use this - so I made up a unique
# bucket name (you don't have to have one created, it will do it
# for you). If you don't want to use Amazon S3, you can backup
# to a file or any of duplicity's supported outputs.
# #
# HIDE_KEY_ID='yes' # NOTE: You do need to keep the "s3+http://<your location>/" format
# even though duplicity supports "s3://<your location>/".
DEST="s3+http://backup-bucket/backup-folder/"
# Other possible locations
#DEST="ftp://user[:password]@other.host[:port]/some_dir"
#DEST="rsync://user@host.com[:port]//absolute_path"
#DEST="scp://user[:password]@other.host[:port]/[/]some_dir"
#DEST="ssh://user[:password]@other.host[:port]/[/]some_dir"
#DEST="file:///home/foobar_user_name/new-backup-test/"
# You can optionally specify the secret keyring file to use for the encryption and # INCLUDE LIST OF DIRECTORIES
# signing keys. If not specified, the default secret keyring is used which is # Here is a list of directories to include; if you want to include
# usually located at ~/.gnupg/secring.gpg # everything that is in root, you could leave this list empty (I think).
# #
#SECRET_KEYRING="/home/foobar_user_name/.gnupg/duplicity.gpg # Here is an example with multiple locations:
#INCLIST=( "/home/*/Documents" \
# "/home/*/Projects" \
# "/home/*/logs" \
# "/home/www/mysql-backups" \
# )
#
# Simpler example with one location:
INCLIST=( "/home/foobar_user_name/Documents/Prose/" )
# Here you can specify options that will be passed to GPG. # EXCLUDE LIST OF DIRECTORIES
# If you can, avoid using quotes here, as it hasn't been tested much yet. # Even though I am being specific about what I want to include,
# You shouldn't need to remove the following default (--no-show-photos) # there is still a lot of stuff I don't need.
# For example an user reported (GitHub issue #145) that since gnupg v2.1, EXCLIST=( "/home/*/Trash" \
# the option "--pinentry-mode loopback" is necessary, "/home/*/Projects/Completed" \
# then set GPG_OPTIONS="--no-show-photos --pinentry-mode loopback" "/**.DS_Store" "/**Icon?" "/**.AppleDouble" \
GPG_OPTIONS="--no-show-photos" )
# ------------------------------------------------------------------------------
# STATIC BACKUP OPTIONS # STATIC BACKUP OPTIONS
# ------------------------------------------------------------------------------
#
# Here you can define the static backup options that you want to run with # Here you can define the static backup options that you want to run with
# duplicity. Reference is the manpage of duplicity (available at # duplicity. Reference is the manpage of duplicity (available at
# http://duplicity.nongnu.org/duplicity.1.html for example) # http://duplicity.nongnu.org/duplicity.1.html for example)
# Useful examples are `--full-if-older-than` option and (for those using # Useful examples are `--full-if-older-than` option and (for those using
# Amazon S3 in Europe) `--s3-use-new-style` and `--s3-european-buckets` options # Amazon S3 in Europe) `--s3-use-new-style` and `--s3-european-buckets` options
# Be sure to separate your options with appropriate spacing. # Be sure to separate your options with appropriate spacing.
STATIC_OPTIONS="--full-if-older-than 14D --s3-use-new-style" STATIC_OPTIONS="--full-if-older-than 14D --s3-use-new-style"
# ------------------------------------------------------------------------------
# FULL BACKUP & REMOVE OLDER THAN SETTINGS # FULL BACKUP & REMOVE OLDER THAN SETTINGS
# ------------------------------------------------------------------------------
#
# Because duplicity will continue to add to each backup as you go, # Because duplicity will continue to add to each backup as you go,
# it will eventually create a very large set of files. Also, incremental # it will eventually create a very large set of files. Also, incremental
# backups leave room for problems in the chain, so doing a "full" # backups leave room for problems in the chain, so doing a "full"
# backup every so often is not a bad idea. # backup every so often isn't not a bad idea.
#
# You can remove older than a specific time period:
# #
# You can either remove older than a specific time period:
#CLEAN_UP_TYPE="remove-older-than" #CLEAN_UP_TYPE="remove-older-than"
#CLEAN_UP_VARIABLE="31D" #CLEAN_UP_VARIABLE="31D"
#
# Or, If you would rather keep a certain (n) number of full backups (rather # Or, If you would rather keep a certain (n) number of full backups (rather
# than removing the files based on their age), you can use what I use: # than removing the files based on their age), you can use what I use:
CLEAN_UP_TYPE="remove-all-but-n-full" CLEAN_UP_TYPE="remove-all-but-n-full"
CLEAN_UP_VARIABLE="4" CLEAN_UP_VARIABLE="2"
# The third option is to skip cleanup altogether, by:
#
#CLEAN_UP_TYPE="none"
#
# In combination with "remove-older-than" clean-up type, you may want
# to keep only the full backups older than (n) number backup sets. For example,
# let's say you set to CLEAN_UP_TYPE="remove-older-than", CLEAN_UP_VARIABLE
# to "6M" (six months), STATIC_OPTIONS to "--full-if-older-than 7D"
# (a full backup every 7 days), and you execute duplicity-backup once a day.
# After six months you'll have 25 full backups, each with daily incrementals
# in between. Perhaps you're keeping the backups past 1 month "just in case",
# and so the older incrementals are overkill - weekly full backups beyond
# one month backward would suffice. In this case you can set
# "REMOVE_INCREMENTALS_OLDER_THAN to, say, "4" which will delete the
# incrementals for backup sets beyond the four most recent, keeping
# only the full weekly backups for those backup sets. The incrementals
# for the four most recent backup sets remain untouched.
#
#REMOVE_INCREMENTALS_OLDER_THAN="4"
# ------------------------------------------------------------------------------
# LOGFILE INFORMATION DIRECTORY # LOGFILE INFORMATION DIRECTORY
# ------------------------------------------------------------------------------ # Provide directory for logfile, ownership of logfile, and verbosity level.
#
# Provide directory for logfile, ownership of logfile & directory, and verbosity level.
# I run this script as root, but save the log files under my user name -- # I run this script as root, but save the log files under my user name --
# just makes it easier for me to read them and delete them as needed. # just makes it easier for me to read them and delete them as needed.
LOGDIR="/home/foobar_user_name/logs/test2/" LOGDIR="/home/foobar_user_name/logs/test2/"
LOG_FILE="duplicity-$(date +%Y-%m-%d_%H-%M).txt" LOG_FILE="duplicity-`date +%Y-%m-%d_%H-%M`.txt"
LOG_FILE_OWNER="foobar_user_name:foobar_user_name" LOG_FILE_OWNER="foobar_user_name:foobar_user_name"
# Note that if the configured LOGDIR does not exist it will be created
# and its owner:group set to that of the configured LOG_FILE_OWNER.
# If the configured LOGDIR already exists no change to owner:group is attempted.
#
#REMOVE_LOGS_OLDER_THAN='30' # (days) uncomment to activate
VERBOSITY="-v3" VERBOSITY="-v3"
# Set the tmpdir for duplicity to use.
#TMPDIR="/tmp"
# ------------------------------------------------------------------------------
# EMAIL ALERT (*thanks: rmarescu*) # EMAIL ALERT (*thanks: rmarescu*)
# ------------------------------------------------------------------------------ # Provide an email address to receive the logfile by email. If no email
# # address is provided, no alert will be sent.
# Provide an email address to receive the logfile by email. If EMAIL_TO is not
# provided, no alert will be sent.
# You can set a custom from email address and a custom subject (both optionally) # You can set a custom from email address and a custom subject (both optionally)
# If no value is provided for the subject, the following value will be # If no value is provided for the subject, the following value will be
# used by default: "duplicity-backup Alert ${LOG_FILE}" # used by default: "duplicity-backup Alert ${LOG_FILE}"
# MTA used: mailx # MTA used: mailx
#EMAIL="admin@example.com"
#EMAIL_TO="admin@example.com"
EMAIL_TO= EMAIL_TO=
EMAIL_FROM= EMAIL_FROM=
EMAIL_SUBJECT= EMAIL_SUBJECT=
EMAIL_FAILURE_ONLY="yes" # send e-mail only if there was an error while creating backup
# command to use to send mail # command to use to send mail
MAIL="mailx" # default command for Linux mail MAIL="mailx"
#MAIL="mail" # for CentOS, if "mailx" fails try this one #MAIL="mail"
#MAIL="ssmtp" #MAIL="ssmtp"
#MAIL="sendmail"
#MAIL="msmtp"
# You may specify a custom mail script instead. It will be called with # TROUBLESHOOTING: If you are having any problems running this script it is
# the following convention:
# MAIL "SUBJECT OF MESSAGE" "TO EMAIL ADDRESS" "FROM EMAIL ADDRESS"
# The email body will be available on stdin.
#
#MAIL="/path/to/custom/mail_script.py"
# ------------------------------------------------------------------------------
# NOTIFICATIONS
# ------------------------------------------------------------------------------
#
# Third-party notification services. If NOTIFICATION_SERVICE is not provided, no
# notifications will be sent.
# Possible values for NOTIFICATION_SERVICE are: slack, pushover, ifttt, telegram
NOTIFICATION_SERVICE=""
NOTIFICATION_FAILURE_ONLY="yes" # send notifications only if there was an error while creating backup
# Provider: Slack
SLACK_HOOK_URL="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
SLACK_CHANNEL="#general"
SLACK_USERNAME="duplicity-backup"
SLACK_EMOJI="package"
# Provider: Pushover
PUSHOVER_TOKEN="" # App token generated at pushover.net
PUSHOVER_USER="" # User key from pushover.net
# Provider: IFTTT
IFTTT_KEY="" # Key for MAKER channel at IFTTT
IFTTT_MAKER_EVENT="duplicity" # name the event to trigger at IFTTT Maker Channel
IFTTT_HOOK_URL="https://maker.ifttt.com/trigger/$IFTTT_MAKER_EVENT/with/key/$IFTTT_KEY" # ONLY change this if IFTTT changes it
IFTTT_VALUE2="" # general purpose value to pass to your maker channel (optional)
# Provider: Telegram
TELEGRAM_CHATID="" #Generate a Telegram bot following guide: https://core.telegram.org/bots#3-how-do-i-create-a-bot
TELEGRAM_KEY=""
# ------------------------------------------------------------------------------
# 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 # 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 # 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 # 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 # printed to the logfile. This way, you can see if the problem is with the
# script or with duplicity. # script or with duplicity.
#
#ECHO=$(which echo) #ECHO=$(which echo)

File diff suppressed because it is too large Load diff