2005-12-28 21:19:29 +01:00
|
|
|
# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
|
2009-05-22 15:27:09 +02:00
|
|
|
# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
|
2005-01-19 20:37:20 +01:00
|
|
|
#
|
|
|
|
# duplicity script for backupninja
|
|
|
|
# requires duplicity
|
|
|
|
#
|
|
|
|
|
|
|
|
getconf options
|
2005-05-24 21:08:51 +02:00
|
|
|
getconf testconnect yes
|
|
|
|
getconf nicelevel 0
|
2007-11-26 08:42:24 +01:00
|
|
|
getconf tmpdir
|
2005-05-24 21:08:51 +02:00
|
|
|
|
|
|
|
setsection gpg
|
|
|
|
getconf password
|
|
|
|
getconf sign no
|
|
|
|
getconf encryptkey
|
2005-12-27 20:38:15 +01:00
|
|
|
getconf signkey
|
2005-05-24 21:08:51 +02:00
|
|
|
|
|
|
|
setsection source
|
2005-01-19 20:37:20 +01:00
|
|
|
getconf include
|
2005-08-09 22:41:37 +02:00
|
|
|
getconf vsnames all
|
|
|
|
getconf vsinclude
|
2005-01-19 20:37:20 +01:00
|
|
|
getconf exclude
|
2005-05-24 21:08:51 +02:00
|
|
|
|
|
|
|
setsection dest
|
2005-08-20 20:17:25 +02:00
|
|
|
getconf incremental yes
|
2010-05-02 17:40:50 +02:00
|
|
|
getconf increments 30
|
2005-05-24 21:08:51 +02:00
|
|
|
getconf keep 60
|
2008-06-24 15:32:34 +02:00
|
|
|
getconf desturl
|
2010-01-09 23:14:17 +01:00
|
|
|
getconf awsaccesskeyid
|
|
|
|
getconf awssecretaccesskey
|
2010-05-06 20:05:20 +02:00
|
|
|
getconf ftp_password
|
2005-05-24 21:08:51 +02:00
|
|
|
getconf sshoptions
|
2005-05-27 20:41:40 +02:00
|
|
|
getconf bandwidthlimit 0
|
2005-01-19 20:37:20 +01:00
|
|
|
getconf desthost
|
|
|
|
getconf destdir
|
|
|
|
getconf destuser
|
|
|
|
destdir=${destdir%/}
|
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### SANITY CHECKS ##############################################################
|
2005-01-19 20:37:20 +01:00
|
|
|
|
2008-06-24 15:32:34 +02:00
|
|
|
[ -n "$desturl" -o -n "$destdir" ] || fatal "The destination directory (destdir) must be set when desturl is not used."
|
2008-06-24 17:39:03 +02:00
|
|
|
[ -n "$include" -o -n "$vsinclude" ] || fatal "No source includes specified"
|
2008-01-14 21:32:19 +01:00
|
|
|
[ -n "$password" ] || fatal "The password option must be set."
|
2010-01-09 23:14:17 +01:00
|
|
|
if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "s3+http" ]; then
|
|
|
|
[ -n "$awsaccesskeyid" -a -n "$awssecretaccesskey" ] || fatal "AWS access keys must be set for S3 backups."
|
|
|
|
fi
|
2010-05-06 20:05:20 +02:00
|
|
|
if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "ftp" ]; then
|
|
|
|
[ -n "$ftp_password" ] || fatal "ftp_password must be set for FTP backups."
|
|
|
|
fi
|
2006-01-19 22:58:38 +01:00
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### VServers
|
2006-01-19 22:56:53 +01:00
|
|
|
# If vservers are configured, check that the ones listed in $vsnames do exist.
|
2006-01-19 22:58:38 +01:00
|
|
|
local usevserver=no
|
2006-01-19 22:56:53 +01:00
|
|
|
if [ $vservers_are_available = yes ]; then
|
|
|
|
if [ "$vsnames" = all ]; then
|
|
|
|
vsnames="$found_vservers"
|
|
|
|
else
|
|
|
|
if ! vservers_exist "$vsnames" ; then
|
|
|
|
fatal "At least one of the vservers listed in vsnames ($vsnames) does not exist."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -n "$vsinclude" ]; then
|
|
|
|
info "Using vservers '$vsnames'"
|
|
|
|
usevserver=yes
|
|
|
|
fi
|
2006-01-17 23:21:39 +01:00
|
|
|
else
|
|
|
|
[ -z "$vsinclude" ] || warning 'vservers support disabled in backupninja.conf, vsincludes configuration lines will be ignored'
|
2005-08-09 22:41:37 +02:00
|
|
|
fi
|
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### See if we can login on $desthost
|
2005-05-24 21:08:51 +02:00
|
|
|
if [ "$testconnect" == "yes" ]; then
|
2008-06-24 15:32:34 +02:00
|
|
|
if [ -n "$desturl" ]; then
|
|
|
|
warning 'testconnect can not be used when desturl is set'
|
|
|
|
else
|
|
|
|
debug "ssh $sshoptions -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'"
|
|
|
|
if [ ! $test ]; then
|
|
|
|
result=`ssh $sshoptions -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'`
|
|
|
|
if [ "$result" != "1" ]; then
|
2009-05-22 14:50:52 +02:00
|
|
|
fatal "Can't connect to $desthost as $destuser."
|
2008-06-24 15:32:34 +02:00
|
|
|
else
|
2009-05-22 14:50:52 +02:00
|
|
|
debug "Connected to $desthost as $destuser successfully"
|
2008-06-24 15:32:34 +02:00
|
|
|
fi
|
2008-01-14 21:32:19 +01:00
|
|
|
fi
|
|
|
|
fi
|
2005-01-19 20:37:20 +01:00
|
|
|
fi
|
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### COMMAND-LINE MANGLING ######################################################
|
|
|
|
|
|
|
|
### initialize $execstr*
|
|
|
|
execstr_command=
|
|
|
|
execstr_options="$options --no-print-statistics"
|
|
|
|
execstr_source=
|
2008-06-24 15:32:34 +02:00
|
|
|
if [ -n "$desturl" ]; then
|
|
|
|
[ -z "$destuser" ] || warning 'the configured destuser is ignored since desturl is set'
|
|
|
|
[ -z "$desthost" ] || warning 'the configured desthost is ignored since desturl is set'
|
|
|
|
[ -z "$destdir" ] || warning 'the configured destdir is ignored since desturl is set'
|
|
|
|
execstr_serverpart="$desturl"
|
|
|
|
else
|
|
|
|
execstr_serverpart="scp://$destuser@$desthost/$destdir"
|
|
|
|
fi
|
2005-05-24 21:08:51 +02:00
|
|
|
|
2010-04-24 19:56:54 +02:00
|
|
|
### duplicity version (ignore anything else than 0-9 and ".")
|
|
|
|
duplicity_version="`duplicity --version | @AWK@ '{print $2}' | @SED@ 's/[^.[:digit:]]//g'`"
|
2007-02-23 19:04:04 +01:00
|
|
|
duplicity_major="`echo $duplicity_version | @AWK@ -F '.' '{print $1}'`"
|
|
|
|
duplicity_minor="`echo $duplicity_version | @AWK@ -F '.' '{print $2}'`"
|
|
|
|
duplicity_sub="`echo $duplicity_version | @AWK@ -F '.' '{print $3}'`"
|
2007-10-15 22:55:59 +02:00
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### ssh/scp/sftp options
|
|
|
|
# 1. duplicity >= 0.4.2 needs --sftp-command
|
|
|
|
# (NB: sftp does not support the -l option)
|
|
|
|
# 2. duplicity 0.4.3 to 0.4.9 replace --ssh-command with --ssh-options, which is
|
|
|
|
# passed to scp and sftp commands by duplicity. We don't use it: since this
|
|
|
|
# version does not use the ssh command anymore, we keep compatibility with
|
|
|
|
# our previous config files by passing $sshoptions to --scp-command and
|
|
|
|
# --sftp-command ourselves
|
2006-06-03 23:08:38 +02:00
|
|
|
|
2005-05-27 20:41:40 +02:00
|
|
|
scpoptions="$sshoptions"
|
2009-07-18 10:45:45 +02:00
|
|
|
if [ "$bandwidthlimit" != 0 ]; then
|
2009-07-18 10:48:10 +02:00
|
|
|
[ -z "$desturl" ] || warning 'The bandwidthlimit option is not used when desturl is set.'
|
2008-06-24 16:11:22 +02:00
|
|
|
scpoptions="$scpoptions -l $bandwidthlimit"
|
|
|
|
fi
|
2005-05-27 20:41:40 +02:00
|
|
|
|
2007-10-15 22:55:59 +02:00
|
|
|
# < 0.4.2 : only uses ssh and scp
|
2007-11-25 18:17:55 +01:00
|
|
|
if [ "$duplicity_major" -le 0 -a "$duplicity_minor" -le 4 -a "$duplicity_sub" -lt 2 ]; then
|
2008-01-14 21:32:19 +01:00
|
|
|
execstr_options="${execstr_options} --scp-command 'scp $scpoptions' --ssh-command 'ssh $sshoptions'"
|
2007-10-15 22:55:59 +02:00
|
|
|
# >= 0.4.2 : also uses sftp, --sftp-command option is now supported
|
2006-06-03 23:08:38 +02:00
|
|
|
else
|
2007-10-15 22:55:59 +02:00
|
|
|
sftpoptions="$sshoptions"
|
|
|
|
# == 0.4.2 : uses ssh, scp and sftp
|
|
|
|
if [ "$duplicity_major" -eq 0 -a "$duplicity_minor" -eq 4 -a "$duplicity_sub" -eq 2 ]; then
|
2008-01-14 21:32:19 +01:00
|
|
|
execstr_options="${execstr_options} --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions' --ssh-command 'ssh $sshoptions'"
|
2007-10-15 22:55:59 +02:00
|
|
|
# >= 0.4.3 : uses only scp and sftp, --ssh-command option is not supported anymore
|
|
|
|
else
|
2008-01-14 21:32:19 +01:00
|
|
|
execstr_options="${execstr_options} --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions'"
|
2007-10-15 22:55:59 +02:00
|
|
|
fi
|
2006-06-03 23:08:38 +02:00
|
|
|
fi
|
2005-05-24 21:08:51 +02:00
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### Symmetric or asymmetric (public/private key pair) encryption
|
2005-12-28 18:32:12 +01:00
|
|
|
if [ -n "$encryptkey" ]; then
|
2008-01-14 21:32:19 +01:00
|
|
|
execstr_options="${execstr_options} --encrypt-key $encryptkey"
|
|
|
|
debug "Data will be encrypted with the GnuPG key $encryptkey."
|
2005-12-28 18:32:12 +01:00
|
|
|
else
|
2008-01-14 21:32:19 +01:00
|
|
|
debug "Data will be encrypted using symmetric encryption."
|
2005-12-28 18:32:12 +01:00
|
|
|
fi
|
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### Data signing (or not)
|
2005-12-28 18:32:12 +01:00
|
|
|
if [ "$sign" == yes ]; then
|
2008-01-14 21:32:19 +01:00
|
|
|
# duplicity is not able to sign data when using symmetric encryption
|
|
|
|
[ -n "$encryptkey" ] || fatal "The encryptkey option must be set when signing."
|
|
|
|
# if needed, initialize signkey to a value that is not empty (checked above)
|
|
|
|
[ -n "$signkey" ] || signkey="$encryptkey"
|
|
|
|
execstr_options="${execstr_options} --sign-key $signkey"
|
|
|
|
debug "Data will be signed will the GnuPG key $signkey."
|
2005-12-28 18:32:12 +01:00
|
|
|
else
|
2008-01-14 21:32:19 +01:00
|
|
|
debug "Data won't be signed."
|
2005-05-24 21:08:51 +02:00
|
|
|
fi
|
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### Incremental or full backup mode
|
|
|
|
# If incremental==yes, use the default duplicity behaviour: perform an
|
|
|
|
# incremental backup if old signatures can be found, else switch to
|
|
|
|
# full backup.
|
|
|
|
# If incremental==no, force a full backup anyway.
|
|
|
|
if [ "$incremental" == "no" ]; then
|
|
|
|
# before 0.4.4, full was an option and not a command
|
2009-05-22 14:50:52 +02:00
|
|
|
if [ "$duplicity_major" -le 0 -a "$duplicity_minor" -le 4 -a "$duplicity_sub" -lt 4 ]; then
|
2008-01-14 21:32:19 +01:00
|
|
|
execstr_options="${execstr_options} --full"
|
|
|
|
else
|
|
|
|
execstr_command="full"
|
|
|
|
fi
|
2010-05-02 12:05:10 +02:00
|
|
|
else
|
2010-05-02 17:40:50 +02:00
|
|
|
# we're in incremental mode
|
|
|
|
if [ "$increments" != "keep" ]; then
|
|
|
|
# if we don't want to keep every increments
|
|
|
|
if [ "`echo $increments | tr -d 0-9`" == "" ]; then
|
|
|
|
increments="${increments}D"
|
2010-05-02 12:05:10 +02:00
|
|
|
fi
|
2010-05-02 17:40:50 +02:00
|
|
|
execstr_options="${execstr_options} --full-if-older-than $increments"
|
2010-05-02 12:05:10 +02:00
|
|
|
fi
|
2005-01-19 20:37:20 +01:00
|
|
|
fi
|
|
|
|
|
2010-03-06 19:25:27 +01:00
|
|
|
### Cleanup options
|
|
|
|
if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 6 -a "$duplicity_sub" -ge 1 ]; then
|
|
|
|
execstr_options="${execstr_options} --extra-clean"
|
|
|
|
fi
|
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### Temporary directory
|
|
|
|
precmd=
|
|
|
|
if [ -n "$tmpdir" ]; then
|
|
|
|
if [ ! -d "$tmpdir" ]; then
|
|
|
|
info "Temporary directory ($tmpdir) does not exist, creating it."
|
|
|
|
mkdir -p "$tmpdir"
|
|
|
|
[ $? -eq 0 ] || fatal "Could not create temporary directory ($tmpdir)."
|
2008-06-25 11:54:45 +02:00
|
|
|
chmod 0700 "$tmpdir"
|
2008-01-14 21:32:19 +01:00
|
|
|
fi
|
|
|
|
info "Using $tmpdir as TMPDIR"
|
|
|
|
precmd="${precmd}TMPDIR=$tmpdir "
|
2005-08-20 20:17:25 +02:00
|
|
|
fi
|
|
|
|
|
2010-05-06 19:27:18 +02:00
|
|
|
### Archive directory
|
2010-05-10 22:15:41 +02:00
|
|
|
# duplicity >= 0.6.01 enables the archive_dir by default, let's put it into /var/cache/backupninja/duplicity
|
2010-05-06 19:27:18 +02:00
|
|
|
# unless the user has specified it.
|
|
|
|
if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 6 -a "$duplicity_sub" -ge 1 ]; then
|
|
|
|
if echo "${options}" | grep -qv -- "--archive-dir" ; then
|
2010-05-10 22:15:41 +02:00
|
|
|
execstr_options="${execstr_options} --archive-dir /var/cache/backupninja/duplicity"
|
2010-05-06 19:27:18 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### Cleanup old backup sets (or not)
|
|
|
|
if [ "$keep" != "yes" ]; then
|
|
|
|
if [ "`echo $keep | tr -d 0-9`" == "" ]; then
|
|
|
|
keep="${keep}D"
|
|
|
|
fi
|
|
|
|
# before 0.4.4, remove-older-than was an option and not a command
|
|
|
|
if [ "$duplicity_major" -le 0 -a "$duplicity_minor" -le 4 -a "$duplicity_sub" -lt 4 ]; then
|
|
|
|
execstr_options="${execstr_options} --remove-older-than $keep"
|
|
|
|
fi
|
|
|
|
fi
|
2005-05-24 21:08:51 +02:00
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### Source
|
2005-01-19 20:37:20 +01:00
|
|
|
|
2006-01-19 22:58:38 +01:00
|
|
|
set -o noglob
|
|
|
|
|
2005-01-19 20:37:20 +01:00
|
|
|
# excludes
|
2010-01-09 00:44:43 +01:00
|
|
|
SAVEIFS=$IFS
|
|
|
|
IFS=$(echo -en "\n\b")
|
2006-01-19 22:58:38 +01:00
|
|
|
for i in $exclude; do
|
2006-06-04 02:30:03 +02:00
|
|
|
str="${i//__star__/*}"
|
2008-01-14 21:32:19 +01:00
|
|
|
execstr_source="${execstr_source} --exclude '$str'"
|
2005-01-19 20:37:20 +01:00
|
|
|
done
|
2010-01-09 00:44:43 +01:00
|
|
|
IFS=$SAVEIFS
|
2008-01-14 21:32:19 +01:00
|
|
|
|
|
|
|
# includes
|
2010-01-09 00:44:43 +01:00
|
|
|
SAVEIFS=$IFS
|
|
|
|
IFS=$(echo -en "\n\b")
|
2006-01-19 22:58:38 +01:00
|
|
|
for i in $include; do
|
2006-06-04 02:36:33 +02:00
|
|
|
[ "$i" != "/" ] || fatal "Sorry, you cannot use 'include = /'"
|
2006-06-04 02:30:03 +02:00
|
|
|
str="${i//__star__/*}"
|
2008-01-14 21:32:19 +01:00
|
|
|
execstr_source="${execstr_source} --include '$str'"
|
2005-01-19 20:37:20 +01:00
|
|
|
done
|
2010-01-09 00:44:43 +01:00
|
|
|
IFS=$SAVEIFS
|
2005-01-19 20:37:20 +01:00
|
|
|
|
2005-08-09 22:41:37 +02:00
|
|
|
# vsincludes
|
2006-01-19 22:56:53 +01:00
|
|
|
if [ $usevserver = yes ]; then
|
2006-06-04 02:30:03 +02:00
|
|
|
for vserver in $vsnames; do
|
2010-01-09 00:44:43 +01:00
|
|
|
SAVEIFS=$IFS
|
|
|
|
IFS=$(echo -en "\n\b")
|
2006-06-04 02:30:03 +02:00
|
|
|
for vi in $vsinclude; do
|
2009-05-22 14:50:52 +02:00
|
|
|
str="${vi//__star__/*}"
|
|
|
|
str="$VROOTDIR/$vserver$str"
|
|
|
|
execstr_source="${execstr_source} --include '$str'"
|
2006-06-04 02:30:03 +02:00
|
|
|
done
|
2010-01-09 00:44:43 +01:00
|
|
|
IFS=$SAVEIFS
|
2006-06-04 02:30:03 +02:00
|
|
|
done
|
2005-08-09 22:41:37 +02:00
|
|
|
fi
|
|
|
|
|
2006-01-19 22:58:38 +01:00
|
|
|
set +o noglob
|
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### EXECUTE ####################################################################
|
|
|
|
|
|
|
|
execstr_source=${execstr_source//\\*/\\\\\\*}
|
|
|
|
|
2010-01-09 23:14:17 +01:00
|
|
|
### If desturl is an S3 URL export the AWS environment variables
|
|
|
|
if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "s3+http" ]; then
|
|
|
|
export AWS_ACCESS_KEY_ID="$awsaccesskeyid"
|
|
|
|
export AWS_SECRET_ACCESS_KEY="$awssecretaccesskey"
|
|
|
|
fi
|
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### Cleanup commands (duplicity >= 0.4.4)
|
|
|
|
|
|
|
|
# cleanup
|
|
|
|
if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 4 -a "$duplicity_sub" -ge 4 ]; then
|
2008-06-29 09:26:36 +02:00
|
|
|
debug "$precmd duplicity cleanup --force $execstr_options $execstr_serverpart"
|
2008-01-14 21:32:19 +01:00
|
|
|
if [ ! $test ]; then
|
|
|
|
export PASSPHRASE=$password
|
2010-05-06 20:05:20 +02:00
|
|
|
export FTP_PASSWORD=$ftp_password
|
2008-01-14 21:32:19 +01:00
|
|
|
output=`nice -n $nicelevel \
|
|
|
|
su -c \
|
2008-06-29 09:26:36 +02:00
|
|
|
"$precmd duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"`
|
2008-01-14 21:32:19 +01:00
|
|
|
exit_code=$?
|
|
|
|
if [ $exit_code -eq 0 ]; then
|
2009-05-22 14:50:52 +02:00
|
|
|
debug $output
|
|
|
|
info "Duplicity cleanup finished successfully."
|
2008-01-14 21:32:19 +01:00
|
|
|
else
|
2009-05-22 14:50:52 +02:00
|
|
|
debug $output
|
|
|
|
warning "Duplicity cleanup failed."
|
2008-01-14 21:32:19 +01:00
|
|
|
fi
|
2007-11-26 08:42:24 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
# remove-older-than
|
|
|
|
if [ "$keep" != "yes" ]; then
|
|
|
|
if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 4 -a "$duplicity_sub" -ge 4 ]; then
|
2008-06-29 09:26:36 +02:00
|
|
|
debug "$precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart"
|
2008-01-14 21:32:19 +01:00
|
|
|
if [ ! $test ]; then
|
|
|
|
export PASSPHRASE=$password
|
2010-05-06 20:05:20 +02:00
|
|
|
export FTP_PASSWORD=$ftp_password
|
2009-05-22 14:50:52 +02:00
|
|
|
output=`nice -n $nicelevel \
|
2008-01-14 21:32:19 +01:00
|
|
|
su -c \
|
2008-06-29 09:26:36 +02:00
|
|
|
"$precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"`
|
2009-05-22 14:50:52 +02:00
|
|
|
exit_code=$?
|
|
|
|
if [ $exit_code -eq 0 ]; then
|
|
|
|
debug $output
|
|
|
|
info "Duplicity remove-older-than finished successfully."
|
|
|
|
else
|
|
|
|
debug $output
|
|
|
|
warning "Duplicity remove-older-than failed."
|
|
|
|
fi
|
2008-01-14 21:32:19 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
2005-01-19 20:37:20 +01:00
|
|
|
|
2008-01-14 21:32:19 +01:00
|
|
|
### Backup command
|
|
|
|
debug "$precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart"
|
2005-01-19 20:37:20 +01:00
|
|
|
if [ ! $test ]; then
|
2010-01-05 06:44:36 +01:00
|
|
|
outputfile=`maketemp backupout`
|
2008-01-14 21:32:19 +01:00
|
|
|
export PASSPHRASE=$password
|
2010-05-06 20:05:20 +02:00
|
|
|
export FTP_PASSWORD=$ftp_password
|
2008-01-14 21:32:19 +01:00
|
|
|
output=`nice -n $nicelevel \
|
|
|
|
su -c \
|
2010-01-05 06:44:36 +01:00
|
|
|
"$precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart >$outputfile 2>&1"`
|
2008-01-14 21:32:19 +01:00
|
|
|
exit_code=$?
|
2010-01-05 06:44:36 +01:00
|
|
|
debug $output
|
|
|
|
cat $outputfile | (while read output ; do
|
2010-01-05 08:28:52 +01:00
|
|
|
info $output
|
2010-01-05 06:44:36 +01:00
|
|
|
done
|
|
|
|
)
|
2008-01-14 21:32:19 +01:00
|
|
|
if [ $exit_code -eq 0 ]; then
|
|
|
|
info "Duplicity finished successfully."
|
|
|
|
else
|
|
|
|
fatal "Duplicity failed."
|
|
|
|
fi
|
2010-01-05 06:44:36 +01:00
|
|
|
rm $outputfile
|
2008-01-14 21:32:19 +01:00
|
|
|
fi
|
2005-01-19 20:37:20 +01:00
|
|
|
|
|
|
|
return 0
|