Files
bin/backupdir2nas.sh
2023-02-23 14:37:19 +00:00

30 lines
927 B
Bash

#!/bin/sh
REPOSITORY=marc@nas:/dat/bak/borg
DIR=/media/hdext
REPONAME=sd32pi3
if [ "$1" != "--prune" ]; then
borg create -v --stats --progress --compression zlib --one-file-system \
$REPOSITORY::"$REPONAME-{now:%Y-%m-%d}" \
$DIR \
--exclude '*/tmp/*' \
--exclude '*/tmpfile/*' \
--exclude '/var/tmp/*' \
--exclude '/var/crash/*' \
--exclude '*/.cache/*' \
--exclude '*/cache/*' \
--exclude '*/.ccache/*' \
--exclude '*/mlocate.db*' \
--exclude '*/Downloads/*' \
--exclude '/run'
fi
# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly
# archives of THIS machine. The '{hostname}-' prefix is very important to
# limit prune's operation to this machine's archives and not apply to
# other machine's archives also.
borg prune -v --stats $REPOSITORY --prefix '{hostname}-' \
--keep-daily=7 --keep-weekly=4 --keep-monthly=20