20ded180e8cd53a3c03c71456ade9cc8a9a72183

Author
Matt Dirba <matt@dirba.org>
Committer
Matt Dirba <matt@dirba.org>
Date

Message

Appending usage information to EMAIL_SUBJECT
	modified:   duplicity-backup.sh

Diff

 1diff --git a/duplicity-backup.sh b/duplicity-backup.sh
 2old mode 100755
 3new mode 100644
 4index 44bab450efc89a13bb0a618fa2ab5b65512c24e0..58eb71340be951e537eeec0dc60ce16362ddde2e
 5--- a/duplicity-backup.sh
 6+++ b/duplicity-backup.sh
 7@@ -401,8 +401,10 @@ get_remote_file_size()
 8     "ss")
 9       TMPDEST="${DEST#*://*/}"
10       TMPDEST="${DEST%/${TMPDEST}}"
11-      ssh_opt=`echo $STATIC_OPTIONS |perl -ne 'print "-i $1" if (/IdentityFile=
12-      SIZE=`${TMPDEST%://*} ${ssh_opt} ${TMPDEST#*//} du -hs ${DEST#${TMPDEST}/
13+      ssh_opt=`echo $STATIC_OPTIONS |perl -ne 'print "-i $1" if (/IdentityFile="?([^"]*)/);'`
14+
15+      SIZE=`${TMPDEST%://*} ${ssh_opt} ${TMPDEST#*//} du -hs ${DEST#${TMPDEST}/} | awk '{print $1}'` 2>> ${LOGFILE}
16+      EMAIL_SUBJECT="$EMAIL_SUBJECT $SIZE `${TMPDEST%://*} ${ssh_opt} ${TMPDEST#*//} df -hP ${DEST#${TMPDEST}/} | awk '{tmp=$5 " used"}END{print tmp}'`" 2>> ${LOGFILE}
17     ;;
18     "fi")
19       TMPDEST=`echo ${DEST} | cut -c 6-`