Conflicts (straight-forward resolution): README.md
This commit is contained in:
commit
a2204bf1dc
3 changed files with 66 additions and 34 deletions
50
README.md
50
README.md
|
|
@ -10,6 +10,7 @@ Optionally, you can set up an email address where the log file will be sent, whi
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Latest version of the code is available at http://github.com/zertrin/duplicity-backup
|
Latest version of the code is available at http://github.com/zertrin/duplicity-backup
|
||||||
|
|
@ -53,7 +54,7 @@ The script looks for its configuration by reading the config file specified by t
|
||||||
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).
|
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:
|
So be sure to either:
|
||||||
* specify the configuration file path on the command line **[recommended]**
|
* 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]**
|
* or to edit the `CONFIG` parameter in the script 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.
|
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.
|
||||||
|
|
@ -68,19 +69,22 @@ NOTE: to ease future updates of the script, you may prefer NOT to edit the scrip
|
||||||
|
|
||||||
-b, --backup runs an incremental backup
|
-b, --backup runs an incremental backup
|
||||||
-f, --full forces a full backup
|
-f, --full forces a full backup
|
||||||
|
|
||||||
-v, --verify verifies the 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
|
-l, --list-current-files lists the files currently backed up in the archive
|
||||||
-s, --collection-status show all the backup sets 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
|
--restore [PATH] restores the entire backup to [path]
|
||||||
files (duplicity time format)
|
--restore-file [FILE_TO_RESTORE] [DESTINATION]
|
||||||
--backup-script automatically backup the script and secret key to
|
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
|
the current working directory
|
||||||
|
|
||||||
-n, --dry-run perform a trial run with no changes made
|
-n, --dry-run perform a trial run with no changes made
|
||||||
-d, --debug echo duplicity commands to logfile
|
-d, --debug echo duplicity commands to logfile
|
||||||
|
|
||||||
|
|
@ -101,37 +105,41 @@ NOTE: to ease future updates of the script, you may prefer NOT to edit the scrip
|
||||||
|
|
||||||
**Restore your entire backup:**
|
**Restore your entire backup:**
|
||||||
|
|
||||||
|
# You will be prompted for a restore directory
|
||||||
duplicity-backup.sh [-c config_file] --restore
|
duplicity-backup.sh [-c config_file] --restore
|
||||||
|
|
||||||
*You will be prompted for a restore directory*
|
# You can also provide a restore folder on the command line.
|
||||||
|
|
||||||
duplicity-backup.sh [-c config_file] --restore /home/user/restore-folder
|
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 or directory in the backup:**
|
||||||
|
|
||||||
**Restore a specific file 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
|
duplicity-backup.sh [-c config_file] --restore-file
|
||||||
|
|
||||||
*You will be prompted for a file to restore to the current directory*
|
# Restores the file img/mom.jpg to the current directory
|
||||||
|
|
||||||
duplicity-backup.sh [-c config_file] --restore-file img/mom.jpg
|
duplicity-backup.sh [-c config_file] --restore-file img/mom.jpg
|
||||||
|
|
||||||
*Restores the file img/mom.jpg to the current directory*
|
# 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
|
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*
|
# 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**
|
**List files in the remote archive**
|
||||||
|
|
||||||
duplicity-backup.sh [-c config_file] --list-current-files
|
duplicity-backup.sh [-c config_file] --list-current-files
|
||||||
|
|
||||||
|
**See the collection status (i.e. all the backup sets in the remore archive)**
|
||||||
|
|
||||||
|
duplicity-backup.sh [-c config_file] --collection-status
|
||||||
|
|
||||||
**Verify the backup**
|
**Verify the backup**
|
||||||
|
|
||||||
duplicity-backup.sh [-c config_file] --verify
|
duplicity-backup.sh [-c config_file] --verify
|
||||||
|
|
||||||
**Backup the script and gpg key (for safekeeping)**
|
**Backup the script and gpg key in a encrypted tarfile (for safekeeping)**
|
||||||
|
|
||||||
duplicity-backup.sh [-c config_file] --backup-script
|
duplicity-backup.sh [-c config_file] --backup-script
|
||||||
|
|
||||||
|
|
@ -149,7 +157,9 @@ To see exactly what is happening when you run duplicity-backup, either pass the
|
||||||
|
|
||||||
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.
|
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 do not perform any backend actions. Together with info verbosity level (`VERBOSITY="-v3"`) duplicity will list all files that will be affected. This way you will know exactly which files will be backed up or restored.
|
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
|
## Wish List
|
||||||
|
|
||||||
* send mails only on failure
|
* send mails only on failure
|
||||||
|
|
|
||||||
|
|
@ -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 Marc Gallet.
|
# Copyright (c) 2012-2013 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
|
||||||
|
|
@ -25,6 +25,9 @@
|
||||||
# Latest code available at:
|
# Latest code available at:
|
||||||
# http://github.com/zertrin/duplicity-backup
|
# http://github.com/zertrin/duplicity-backup
|
||||||
#
|
#
|
||||||
|
# List of contributors:
|
||||||
|
# https://github.com/zertrin/duplicity-backup/graphs/contributors
|
||||||
|
#
|
||||||
# ---------------------------------------------------------------------------- #
|
# ---------------------------------------------------------------------------- #
|
||||||
|
|
||||||
# #############################################
|
# #############################################
|
||||||
|
|
@ -97,12 +100,19 @@ ROOT="/home"
|
||||||
# remote file size check will work.
|
# remote file size check will work.
|
||||||
#DEST="s3://host/backup-bucket/backup-folder/"
|
#DEST="s3://host/backup-bucket/backup-folder/"
|
||||||
DEST="s3+http://foobar-backup-bucket/backup-folder/"
|
DEST="s3+http://foobar-backup-bucket/backup-folder/"
|
||||||
|
#
|
||||||
# Other possible locations
|
# 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="ftp://user[:password]@other.host[:port]/some_dir"
|
#DEST="ftp://user[:password]@other.host[:port]/some_dir"
|
||||||
#DEST="rsync://user@host.com[:port]//absolute_path"
|
#DEST="rsync://user@host.com[:port]//absolute_path"
|
||||||
#DEST="scp://user[:password]@other.host[:port]/[/]some_dir"
|
#DEST="scp://user[:password]@other.host[:port]/[/]some_dir"
|
||||||
#DEST="ssh://user[:password]@other.host[:port]/[/]some_dir"
|
#DEST="ssh://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="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"
|
||||||
|
|
||||||
# DESTINATION BACKEND PASSWORD
|
# DESTINATION BACKEND PASSWORD
|
||||||
# Instead of setting the password needed for the backup destination in the
|
# Instead of setting the password needed for the backup destination in the
|
||||||
|
|
@ -116,7 +126,7 @@ DEST="s3+http://foobar-backup-bucket/backup-folder/"
|
||||||
|
|
||||||
# INCLUDE LIST OF DIRECTORIES
|
# INCLUDE LIST OF DIRECTORIES
|
||||||
# Here is a list of directories to include; if you want to include
|
# Here is a list of directories to include; if you want to include
|
||||||
# everything that is in root, leave this list empty.
|
# everything that is in ROOT, leave this list empty.
|
||||||
#
|
#
|
||||||
# Here is an example with multiple locations:
|
# Here is an example with multiple locations:
|
||||||
#INCLIST=( "/home/*/Documents" \
|
#INCLIST=( "/home/*/Documents" \
|
||||||
|
|
@ -209,6 +219,7 @@ MAIL="mailx" # default command for Linux mail
|
||||||
#MAIL="mail" # for CentOS, if "mailx" fails try this one
|
#MAIL="mail" # for CentOS, if "mailx" fails try this one
|
||||||
#MAIL="ssmtp"
|
#MAIL="ssmtp"
|
||||||
#MAIL="sendmail"
|
#MAIL="sendmail"
|
||||||
|
#MAIL="msmtp"
|
||||||
|
|
||||||
# TROUBLESHOOTING: If you are having any problems running this script it is
|
# 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
|
||||||
|
|
|
||||||
|
|
@ -48,14 +48,21 @@ echo "USAGE:
|
||||||
-b, --backup runs an incremental backup
|
-b, --backup runs an incremental backup
|
||||||
-f, --full forces a full backup
|
-f, --full forces a full backup
|
||||||
-v, --verify verifies the backup
|
-v, --verify verifies the backup
|
||||||
|
-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 [PATH] restores the entire backup to [path]
|
||||||
--restore-file [FILE_TO_RESTORE] [DESTINATION]
|
--restore-file [FILE_TO_RESTORE] [DESTINATION]
|
||||||
restore a specific file
|
restore a specific file
|
||||||
-l, --list-current-files lists the files currently backed up in the archive
|
--restore-dir [DIR_TO_RESTORE] [DESTINATION]
|
||||||
-s, --collection-status show all the backup sets in the archive
|
restore a specific directory
|
||||||
--backup-script automatically backup the script and secret key to
|
|
||||||
the current working directory
|
|
||||||
-t, --time TIME specify the time from which to restore or list files
|
-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
|
-n, --dry-run perform a trial run with no changes made
|
||||||
-d, --debug echo duplicity commands to logfile
|
-d, --debug echo duplicity commands to logfile
|
||||||
|
|
||||||
|
|
@ -75,7 +82,7 @@ echo "USAGE:
|
||||||
while getopts ":c:t:bfvlsnd-:" opt; do
|
while getopts ":c:t:bfvlsnd-:" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
# parse long options (a bit tricky because builtin getopts does not
|
# parse long options (a bit tricky because builtin getopts does not
|
||||||
# manage long options and i don't want to impose GNU getopt dependancy)
|
# manage long options and I don't want to impose GNU getopt dependancy)
|
||||||
-)
|
-)
|
||||||
case "$OPTARG" in
|
case "$OPTARG" in
|
||||||
# --restore [restore dest]
|
# --restore [restore dest]
|
||||||
|
|
@ -88,7 +95,8 @@ while getopts ":c:t:bfvlsnd-:" opt; do
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
# --restore-file [file to restore] [restore dest]
|
# --restore-file [file to restore] [restore dest]
|
||||||
restore-file)
|
# --restore-dir [path to restore] [restore dest]
|
||||||
|
restore-file|restore-dir)
|
||||||
COMMAND=$OPTARG
|
COMMAND=$OPTARG
|
||||||
# We try to find the first optional value [file to restore]
|
# We try to find the first optional value [file to restore]
|
||||||
if [ ! -z "${!OPTIND:0:1}" -a ! "${!OPTIND:0:1}" = "-" ]; then
|
if [ ! -z "${!OPTIND:0:1}" -a ! "${!OPTIND:0:1}" = "-" ]; then
|
||||||
|
|
@ -271,6 +279,8 @@ email_logfile()
|
||||||
EMAIL_SUBJECT=${EMAIL_SUBJECT:="duplicity-backup alert ${LOG_FILE}"}
|
EMAIL_SUBJECT=${EMAIL_SUBJECT:="duplicity-backup alert ${LOG_FILE}"}
|
||||||
if [ "$MAIL" = "ssmtp" ]; then
|
if [ "$MAIL" = "ssmtp" ]; then
|
||||||
echo """Subject: ${EMAIL_SUBJECT}""" | cat - ${LOGFILE} | ${MAILCMD} -s ${EMAIL_TO}
|
echo """Subject: ${EMAIL_SUBJECT}""" | cat - ${LOGFILE} | ${MAILCMD} -s ${EMAIL_TO}
|
||||||
|
elif [ "$MAIL" = "msmtp" ]; then
|
||||||
|
echo """Subject: ${EMAIL_SUBJECT}""" | cat - ${LOGFILE} | ${MAILCMD} ${EMAIL_TO}
|
||||||
elif [ "$MAIL" = "mailx" ]; then
|
elif [ "$MAIL" = "mailx" ]; then
|
||||||
EMAIL_FROM=${EMAIL_FROM:+"-r ${EMAIL_FROM}"}
|
EMAIL_FROM=${EMAIL_FROM:+"-r ${EMAIL_FROM}"}
|
||||||
cat ${LOGFILE} | ${MAILCMD} -s """${EMAIL_SUBJECT}""" $EMAIL_FROM ${EMAIL_TO}
|
cat ${LOGFILE} | ${MAILCMD} -s """${EMAIL_SUBJECT}""" $EMAIL_FROM ${EMAIL_TO}
|
||||||
|
|
@ -522,7 +532,7 @@ get_lock
|
||||||
|
|
||||||
INCLUDE=
|
INCLUDE=
|
||||||
EXCLUDE=
|
EXCLUDE=
|
||||||
EXLUDEROOT=
|
EXCLUDEROOT=
|
||||||
|
|
||||||
case "$COMMAND" in
|
case "$COMMAND" in
|
||||||
"backup-script")
|
"backup-script")
|
||||||
|
|
@ -587,16 +597,17 @@ case "$COMMAND" in
|
||||||
duplicity_backup
|
duplicity_backup
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"restore-file")
|
"restore-file"|"restore-dir")
|
||||||
ROOT=$DEST
|
ROOT=$DEST
|
||||||
OPTION=
|
OPTION="restore"
|
||||||
|
|
||||||
if [ ! -z "$TIME" ]; then
|
if [ ! -z "$TIME" ]; then
|
||||||
STATIC_OPTIONS="$STATIC_OPTIONS --time $TIME"
|
STATIC_OPTIONS="$STATIC_OPTIONS --time $TIME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! "$FILE_TO_RESTORE" ]]; then
|
if [[ ! "$FILE_TO_RESTORE" ]]; then
|
||||||
echo "Which file do you want to restore (eg, mail/letter.txt):"
|
echo "Which file or directory do you want to restore?"
|
||||||
|
echo "(give the path relative to the root of the backup eg, mail/letter.txt):"
|
||||||
read -e FILE_TO_RESTORE
|
read -e FILE_TO_RESTORE
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
@ -623,7 +634,7 @@ case "$COMMAND" in
|
||||||
|
|
||||||
setup_passphrase
|
setup_passphrase
|
||||||
echo "Restoring now ..."
|
echo "Restoring now ..."
|
||||||
#use INCLUDE variable without create another one
|
#use INCLUDE variable without creating another one
|
||||||
INCLUDE="--file-to-restore ${FILE_TO_RESTORE}"
|
INCLUDE="--file-to-restore ${FILE_TO_RESTORE}"
|
||||||
duplicity_backup
|
duplicity_backup
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue