Commit 0b90d11f authored by Daniel STAN's avatar Daniel STAN

fullsend sur backup-recv

parent 6a0e6f61
#!/bin/bash
# Path to the backup fs
FS_DIR=/mnt/backup
source backup_config.sh
# Path to the backup directory (form FS_DIR)
BACK_DIR=ailesv
available_local () {
# TODO escape
btrfs sub list $FS_DIR | sed "s/^.* path $BACK_DIR\/\($PATTERN\)$/\1/; t; d"
}
available_remote () {
$REMOTE available
}
# Extra filter for volumes (sed syntax)
PATTERN=1d_.*
available_common () {
(available_remote && available_local) | sort | uniq -c | sed "s/^ *2 //; t; d"
}
if [ "$1" = "available" ]; then
# TODO escape
btrfs sub list $FS_DIR | sed "s/^.* path $BACK_DIR\/\($PATTERN\)$/\1/; t; d"
available_local
elif [ "$1" = "candidates" ]; then
echo "Common candidates:"
available_common
elif [ "$1" = "fullsend" ]; then
SNAP=`available_local | sort | tail -n 1`
btrfs send $FS_DIR/$BACK_DIR/$SNAP | $REMOTE receive
elif [ "$1" = "receive" ]; then
btrfs receive $FS_DIR/$BACK_DIR
exit
fi
if [ `hostname` = 'ailesv' ]; then
# Path to the backup fs
FS_DIR=/home
# Path to the backup directory (form FS_DIR)
BACK_DIR=.snapshot
# Extra filter for volumes (sed syntax)
PATTERN=1d_.*
# REMOTE command SSH
REMOTE='ssh kugel /root/scripts-perso/backup-recv'
else
# Path to the backup fs
FS_DIR=/mnt/backup
# Path to the backup directory (form FS_DIR)
BACK_DIR=ailesv
# Extra filter for volumes (sed syntax)
PATTERN=1d_.*
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment