works
This commit is contained in:
+10
-5
@@ -10,13 +10,18 @@ HOSTNAME=$(hostname)
|
||||
DATE=$(date +%Y-%m-%d_%H-%M-%S)
|
||||
ARCHIVE_NAME="${HOSTNAME}-${DATE}"
|
||||
|
||||
shopt -s globstar
|
||||
borg create \
|
||||
# Resolve symlinks externally and feed real paths to borg via --paths-from-stdin.
|
||||
# - 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 \
|
||||
--stats \
|
||||
--compression lz4 \
|
||||
--follow-symlinks \
|
||||
::$ARCHIVE_NAME \
|
||||
/BACKUP/**/current*
|
||||
--paths-from-stdin \
|
||||
::$ARCHIVE_NAME
|
||||
|
||||
echo "Backup completed: $ARCHIVE_NAME"
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user