From d3c21028b004b7257fb9512d31ac4e1b3c0e8fd8 Mon Sep 17 00:00:00 2001 From: Philip Date: Sun, 18 Jan 2015 14:50:35 +0000 Subject: [PATCH 1/2] If we create the log dir chown it to log file owner --- duplicity-backup.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/duplicity-backup.sh b/duplicity-backup.sh index 745e635..af88800 100755 --- a/duplicity-backup.sh +++ b/duplicity-backup.sh @@ -281,6 +281,14 @@ check_logdir() else echo "Directory ${LOGDIR} successfully created." fi + echo "Attempting to change owner:group of ${LOGDIR} to ${LOG_FILE_OWNER} ..." + if ! chown ${LOG_FILE_OWNER} ${LOGDIR}; then + echo "User ${USER} could not change the owner:group of ${LOGDIR} to $LOG_FILE_OWNER" + echo "Aborting..." + exit 1 + else + echo "Directory ${LOGDIR} successfully changed to owner:group of ${LOG_FILE_OWNER}" + fi elif [ ! -w ${LOGDIR} ]; then echo "Log directory ${LOGDIR} is not writeable by this user: ${USER}" echo "Aborting..." From bdcb1bffd7d26b96abc3ac8414ce012c47b47be4 Mon Sep 17 00:00:00 2001 From: Philip Date: Sun, 18 Jan 2015 18:01:32 +0000 Subject: [PATCH 2/2] Update example config with log dir creation info --- duplicity-backup.conf.example | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/duplicity-backup.conf.example b/duplicity-backup.conf.example index 0cd5a00..6f27460 100644 --- a/duplicity-backup.conf.example +++ b/duplicity-backup.conf.example @@ -233,13 +233,16 @@ CLEAN_UP_VARIABLE="4" #REMOVE_INCREMENTALS_OLDER_THAN="4" # LOGFILE INFORMATION DIRECTORY -# Provide directory for logfile, ownership of logfile, and verbosity level. +# Provide directory for logfile, ownership of logfile & directory, and verbosity level. # I run this script as root, but save the log files under my user name -- # just makes it easier for me to read them and delete them as needed. LOGDIR="/home/foobar_user_name/logs/test2/" LOG_FILE="duplicity-`date +%Y-%m-%d_%H-%M`.txt" LOG_FILE_OWNER="foobar_user_name:foobar_user_name" +# Note that if the configured LOGDIR does not exist it will be created +# and its owner:group set to that of the configured LOG_FILE_OWNER. +# If the configured LOGDIR already exists no change to owner:group is attempted. #REMOVE_LOGS_OLDER_THAN='30' # (days) uncomment to activate VERBOSITY="-v3"