Allow override of dstdir with subvolume delta and add snapshot with retention
This commit is contained in:
parent
bcd6f0f635
commit
f641a5445e
@ -3,7 +3,7 @@ set -e
|
||||
|
||||
SRC="$1"
|
||||
RECV="$2"
|
||||
DSTDIR="$SRC/.snap"
|
||||
DSTDIR="$SRC/${3:-.snap}"
|
||||
CDATE="$(date '+%s')"
|
||||
PREV="prev"
|
||||
CUR="cur"
|
||||
|
18
btrfs/snapshot
Executable file
18
btrfs/snapshot
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# BTRFS rolling snapshots
|
||||
# CC0 ~caskd
|
||||
|
||||
: ${SRC:?'Source not defined'}
|
||||
: ${DEST:?'Destination not defined'}
|
||||
: ${NAME:?'Name not defined'}
|
||||
: ${SN:?'Selection name not defined'}
|
||||
: ${RT:?'Retention time not defined'}
|
||||
|
||||
s="$SRC"
|
||||
d="$DEST/$SN/$NAME"
|
||||
|
||||
mkdir -p "${d%/*}"
|
||||
find "$DEST" -mindepth 1 -maxdepth 1 -type d -ctime +"$RT" -exec echo "{}/$NAME" ';' | xargs btrfs subvolume del
|
||||
btrfs subvolume delete "$d"
|
||||
btrfs subvolume snapshot -r "$s" "$d"
|
Loading…
Reference in New Issue
Block a user