d3c21028b004b7257fb9512d31ac4e1b3c0e8fd8

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

Message

If we create the log dir chown it to log file owner

Diff

 1diff --git a/duplicity-backup.sh b/duplicity-backup.sh
 2index 745e635140e8b20310dc26a6aab22c53816d651d..af888002aba24f6f45f119859f3cfba27bcfceac 100755
 3--- a/duplicity-backup.sh
 4+++ b/duplicity-backup.sh
 5@@ -281,6 +281,14 @@ check_logdir()
 6     else
 7       echo "Directory ${LOGDIR} successfully created."
 8     fi
 9+    echo "Attempting to change owner:group of ${LOGDIR} to ${LOG_FILE_OWNER} ..."
10+    if ! chown ${LOG_FILE_OWNER} ${LOGDIR}; then
11+      echo "User ${USER} could not change the owner:group of ${LOGDIR} to $LOG_FILE_OWNER"
12+      echo "Aborting..."
13+      exit 1
14+    else
15+      echo "Directory ${LOGDIR} successfully changed to owner:group of ${LOG_FILE_OWNER}"
16+    fi
17   elif [ ! -w ${LOGDIR} ]; then
18     echo "Log directory ${LOGDIR} is not writeable by this user: ${USER}"
19     echo "Aborting..."