wip backup script

This commit is contained in:
root 2022-12-11 08:32:08 +00:00
parent 7133234437
commit d20a3b57f0
1 changed files with 17 additions and 0 deletions

17
tilserv/dobackup Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
#if [ -z $1 ]; then echo "Usage: $0 [target pool]"; exit 1; fi
targetpool="bighdd/backup"
incbackup="nvme/gitea@inc"
newsnap="gitea@$(date +%Y%m%d)"
latestsnap=$(zfs list -r -t snapshot -H -o name bighdd/backup/gitea | grep gitea@ | tail -n1)
if [ "bighdd/backup/$newsnap" != "$latestsnap" ]; then
set -x
zfs snapshot -r nvme/$newsnap
zfs send -RI $incbackup nvme/$newsnap | zfs recv -Fu ${targetpool}/gitea
zfs destroy nvme/$newsnap
set +x
else
echo "Backup ($targetpool) already contains snapshot $backupsnap"
fi