#!/bin/bash DAILY_NAME=$( date +'%Y%m%d' ) LINK_DEST=$( date +'%Y%m%d' -d "1 day ago" ) SOURCE_PATH="/local-current-backup/" BACKUPS_PATH="/backups/daily" DESTINATION_PATH="${BACKUPS_PATH%/}/${DAILY_NAME}" rsync --archive --links --recursive \ --hard-links --perms --owner --group \ --devices --specials --times --sparse \ --delete --numeric-ids --link-dest="${BACKUPS_PATH%/}/${LINK_DEST}" \ "${SOURCE_PATH%/}/" "${DESTINATION_PATH}"