Update btrfs-backup script

This commit is contained in:
albert 2024-12-16 16:14:42 +01:00
parent 9d8e794c24
commit 33c3a5a1cd
Signed by: albert
GPG key ID: 3895DD267CA11BA9

View file

@ -29,7 +29,7 @@ fi
# Get latest snapshot number from snapper # Get latest snapshot number from snapper
LATEST_SNAPSHOT=$(sudo snapper -c "$SNAPPER_CONFIG" list | tail -n 1 | awk '{print $1}') LATEST_SNAPSHOT=$(sudo snapper -c "$SNAPPER_CONFIG" list | tail -n 1 | awk '{print $1}')
HOSTNME=$(hostname)
REMOTE_HOST="root@synology" REMOTE_HOST="root@synology"
BASE_DEST_PATH="/volume1/BTRFS_Receives/`hostname`/${SNAPPER_CONFIG}" BASE_DEST_PATH="/volume1/BTRFS_Receives/`hostname`/${SNAPPER_CONFIG}"
DEST_PATH="/volume1/BTRFS_Receives/`hostname`/${SNAPPER_CONFIG}/${LATEST_SNAPSHOT}" DEST_PATH="/volume1/BTRFS_Receives/`hostname`/${SNAPPER_CONFIG}/${LATEST_SNAPSHOT}"
@ -73,8 +73,8 @@ verify_remote() {
# Function to get remote snapshots # Function to get remote snapshots
get_remote_snapshots() { get_remote_snapshots() {
# ssh "$REMOTE_HOST" "find '$BASE_DEST_PATH' -maxdepth 2 -type d -name 'snapshot*' | sort -n" ssh "$REMOTE_HOST" "find '$BASE_DEST_PATH' -maxdepth 2 -type d -name 'snapshot*' | sort -n"
ssh "$REMOTE_HOST" "btrfs subvolume list /volume1/ -t | grep `hostname` | grep $SNAPPER_CONFIG" # ssh "$REMOTE_HOST" "btrfs subvolume list /volume1/ -t | grep $HOSTNAME | grep $SNAPPER_CONFIG"
} }
# Function to cleanup old remote snapshots # Function to cleanup old remote snapshots