Initial commit

This commit is contained in:
2025-07-11 19:44:33 -04:00
parent 4d7287ea56
commit e099e2dbe6
3 changed files with 42 additions and 0 deletions

38
backup.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
set -euo pipefail
BASEDIR="$(dirname ${0} | sed "s|^.|${PWD}|")"
source "${BASEDIR}/backup.conf"
TIMESTAMP="$(date +%Y_%m_%d-%H_%M_%S)"
SNAPSHOT="${SOURCE}@${TIMESTAMP}"
sudo zfs snapshot ${SNAPSHOT}
if [[ -f "${BASEDIR}/backup-last" ]]; then
BACKUP_LAST="$(cat ${BASEDIR}/backup-last)"
sudo \
zfs \
send \
-i ${BACKUP_LAST} \
${SNAPSHOT} \
| \
sudo \
zfs \
receive \
${DEST}
else
sudo \
zfs \
send \
${SNAPSHOT} \
| \
sudo \
zfs \
receive \
${DEST}
fi
printf "@${TIMESTAMP}" | tee "${BASEDIR}/backup-last" &> /dev/null