You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Create the backup directory if it doesn't exist
|
|
|
|
mkdir -p "${RSYNC_DEST}"
|
|
|
|
|
|
|
|
# Run the rsync backup
|
|
|
|
rsync -avP --delete --prune-empty-dirs --include-from="${RSYNC_MANIFEST}" \
|
|
|
|
"${RSYNC_SOURCE}/" \
|
|
|
|
--link-dest "${RSYNC_LATEST_LINK}" \
|
|
|
|
"${RSYNC_DEST_PATH}"
|
|
|
|
|
|
|
|
# Update the latest hardlink
|
|
|
|
rm -rf "${RSYNC_LATEST_LINK}"
|
|
|
|
ln -s "${RSYNC_DEST_PATH}" "${RSYNC_LATEST_LINK}"
|
|
|
|
|
|
|
|
# A hacky fix for the NFS timestamp
|
|
|
|
touch "${RSYNC_DEST_PATH}"/timestamp.fix
|
|
|
|
|
|
|
|
# Run retention policy
|
|
|
|
cd "${RSYNC_DEST}"
|
|
|
|
rm -rf `ls -t | tail -n +$(("${RSYNC_RETENTION_KEEP_LAST}"+2))`
|