Update btrfs backup script

This commit is contained in:
albert 2024-12-16 15:47:58 +01:00
parent 8823677260
commit 0843563f84
Signed by: albert
GPG key ID: 3895DD267CA11BA9

View file

@ -31,6 +31,7 @@ fi
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}')
REMOTE_HOST="root@synology" REMOTE_HOST="root@synology"
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}"
STATE_FILE="/var/lib/snapper-backup-${SNAPPER_CONFIG}.state" STATE_FILE="/var/lib/snapper-backup-${SNAPPER_CONFIG}.state"
LOG_FILE="/var/log/snapper-backup-${SNAPPER_CONFIG}.log" LOG_FILE="/var/log/snapper-backup-${SNAPPER_CONFIG}.log"
@ -72,7 +73,7 @@ verify_remote() {
# Function to get remote snapshots # Function to get remote snapshots
get_remote_snapshots() { get_remote_snapshots() {
ssh "$REMOTE_HOST" "find '$DEST_PATH' -maxdepth 1 -type d -name 'snapshot*' | sort -n" ssh "$REMOTE_HOST" "find '$BASE_DEST_PATH' -maxdepth 1 -type d -name 'snapshot*' | sort -n"
} }
# Function to cleanup old remote snapshots # Function to cleanup old remote snapshots