add backup:days as zfs value

This commit is contained in:
Jochen Welzel 2021-01-07 13:14:44 +01:00
parent 4e4358e517
commit c2f41aa4e4

View File

@ -31,18 +31,19 @@ then
helpFunction helpFunction
fi fi
echo "$(date +%Y-%m-%d_%H:%M:%S): Starting Backup of $VM"
DAYS=$(zfs get backup:days -H -o value $SRCZFS) DAYS=$(zfs get backup:days -H -o value $SRCZFS)
if [[ $DAYS == "-" ]] if [[ $DAYS == "-" ]]
then then
DAYS=7 DAYS=7
fi fi
echo "$(date +%Y-%m-%d_%H:%M:%S): Keeping backups for $DAYS days"
DAYS=$(($DAYS + 1)) DAYS=$(($DAYS + 1))
DATE=$(date "+%Y%m%d%H%M") DATE=$(date "+%Y%m%d%H%M")
DATEOLD=$(date -d -"$DAYS"day "+%Y%m%d") DATEOLD=$(date -d -"$DAYS"day "+%Y%m%d")
SNAPNAME="backup_$DATE" SNAPNAME="backup_$DATE"
echo "$(date +%Y-%m-%d_%H:%M:%S): Starting Backup of $VM"
abortFunction() abortFunction()
{ {