This commit is contained in:
oliver
2026-04-21 16:04:12 -03:00
parent 04f665a20d
commit 3c33bd86e5
2 changed files with 10 additions and 5 deletions
+10 -5
View File
@@ -10,13 +10,18 @@ HOSTNAME=$(hostname)
DATE=$(date +%Y-%m-%d_%H-%M-%S) DATE=$(date +%Y-%m-%d_%H-%M-%S)
ARCHIVE_NAME="${HOSTNAME}-${DATE}" ARCHIVE_NAME="${HOSTNAME}-${DATE}"
shopt -s globstar # Resolve symlinks externally and feed real paths to borg via --paths-from-stdin.
borg create \ # - First find: locates all current* symlinks under /BACKUP and resolves them with realpath.
# - Second find: locates all regular current* files under /BACKUP (non-symlinks).
# - sort -u: deduplicates in case a resolved symlink target overlaps with a regular file.
{
find /BACKUP -name 'current*' -type l -print0 | xargs -0 -I {} realpath {}
find /BACKUP -name 'current*' ! -type l
} | sort -u | borg create \
--verbose \ --verbose \
--stats \ --stats \
--compression lz4 \ --compression lz4 \
--follow-symlinks \ --paths-from-stdin \
::$ARCHIVE_NAME \ ::$ARCHIVE_NAME
/BACKUP/**/current*
echo "Backup completed: $ARCHIVE_NAME" echo "Backup completed: $ARCHIVE_NAME"
Binary file not shown.