e94732a4739e49f8393e6719349ad85e1a7c9918

Author
Philip <philip@yewtreeapps.com>
Committer
Philip <philip@yewtreeapps.com>
Date

Message

Add destination type to disk use report and make format consistent with source du report

Diff

 1diff --git a/duplicity-backup.sh b/duplicity-backup.sh
 2index f43cf4abc7713a5d843d18aa513868f3b543e4ef..4447d64bfb6f8e952f7198c186516b990bfde27d 100755
 3--- a/duplicity-backup.sh
 4+++ b/duplicity-backup.sh
 5@@ -398,14 +398,16 @@ get_source_file_size()
 6 get_remote_file_size()
 7 {
 8   echo "---------[ Destination Disk Use Information ]--------" >> ${LOGFILE}
 9-
10+  FRIENDLY_TYPE_NAME=""
11   dest_type=`echo ${DEST} | cut -c 1,2`
12   case $dest_type in
13     "fi")
14+      FRIENDLY_TYPE_NAME="File"
15       TMPDEST=`echo ${DEST} | cut -c 6-`
16       SIZE=`du -hs ${TMPDEST} | awk '{print $1}'`
17     ;;
18     "s3")
19+      FRIENDLY_TYPE_NAME="S3"
20       if $S3CMD_AVAIL ; then
21           TMPDEST=$(echo ${DEST} | cut -c 11-)
22           dest_scheme=$(echo ${DEST} | cut -f -1 -d :)
23@@ -416,18 +418,20 @@ get_remote_file_size()
24           SIZE=`${S3CMD} du -H s3://${TMPDEST} | awk '{print $1}'`
25       else
26           if ! $S3CMD_CONF_FOUND ; then
27-              SIZE="s3cmd config not found"
28+              SIZE="-s3cmd config not found-"
29           else
30-              SIZE="s3cmd not found in PATH"
31+              SIZE="-s3cmd not found in PATH-"
32           fi
33       fi
34     ;;
35     *)
36-      SIZE="unsupported by backend"
37+      # cover all so just grab first 4 chars from DEST
38+      FRIENDLY_TYPE_NAME=`echo ${DEST} | cut -c 1,4`
39+      SIZE="unsupported on"
40     ;;
41   esac
42 
43-  echo "Current Remote Backup Disk Usage: ${SIZE}" >> ${LOGFILE}
44+  echo -e ""$SIZE"\t"$FRIENDLY_TYPE_NAME" type backend" >> ${LOGFILE}
45   echo >> ${LOGFILE}
46 }
47