works
This commit is contained in:
+10
-5
@@ -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.
Reference in New Issue
Block a user