|
@@ -24,6 +24,16 @@ for sourceFolder in "${!backup_folders[@]}"
|
|
|
do
|
|
|
mkdir -p ${backup_folders[$sourceFolder]}
|
|
|
|
|
|
+ #Exclude files
|
|
|
+ IFS=';' read -ra split <<< "${backup_folders[$sourceFolder]}"
|
|
|
+ #check if exclude file is given and file exists. Set to zero if not existing.
|
|
|
+ if [[ -n ${split[1]} ]] && ! [ -f ${split[1]} ]; then
|
|
|
+ echo "Error: Could not find exclude file ${split[1]}. Ignoring it." | tee $tmpLogFilePath
|
|
|
+ split[1]=""
|
|
|
+ else
|
|
|
+ echo "Exclude file: ${split[1]}" | tee $tmpLogFilePath
|
|
|
+ fi
|
|
|
+
|
|
|
while [ "$retryAttempts" -ge "0" ]
|
|
|
do
|
|
|
echo "Starting Job" | tee -a $tmpLogFilePath
|
|
@@ -31,7 +41,8 @@ do
|
|
|
echo "DEST: ${backup_folders[$sourceFolder]}" | tee -a $tmpLogFilePath
|
|
|
date | tee -a $tmpLogFilePath
|
|
|
#SSH Host settings need to be set in the ssh client config!
|
|
|
- rsync --delete --out-format="%t %f %''b" -avz $sourceFolder ${backup_folders[$sourceFolder]} | tee -a $tmpLogFilePath 2>&1
|
|
|
+ excludeDIRs=${split[1]}
|
|
|
+ rsync --delete --out-format="%t %f %''b" -avz ${excludeDIRs:+"--exclude-from" "$excludeDIRs}"} $sourceFolder ${backup_folders[$sourceFolder]} | tee -a $tmpLogFilePath 2>&1
|
|
|
rsyncExitCode=$?
|
|
|
echo "Ending backup job" | tee -a $tmpLogFilePath
|
|
|
date | tee -a $tmpLogFilePath
|