Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while IFS= read -r path
- do
- [ -z $path ] && continue
- echo "$(date +'%d-%m-%Y %H:%M:%S') -- Creating backup for $path"
- # Create or update the remote backup
- ssh ${remoteUser}@$serverLocation -i sshKey/ssh mkdir -p ${remoteBasedir}/$path # Create the directory
- rsync --compress --recursive -e "ssh -i sshKey/ssh -l $remoteUser" \
- --delete --links --perms \
- $path $serverLocation:${remoteBasedir}/$path
- rSyncStatus=$?
- [ $rSyncStatus -eq 0 ] && status="success" || status="fail"
- echo "$(date +'%d-%m-%Y %H:%M:%S') -- Exit code for backup: $rSyncStatus ($status)"
- echo "$(date +'%d-%m-%Y %H:%M:%S') -- ---------------"
- [ $status == "fail" ] && declare -i backupResult=0 # If this backup fails, we count the overall backup process as a failure
- done < "$backupPathsFile"
Add Comment
Please, Sign In to add comment