Backup server
mkdir /path/to/repo
chown backup:backup /path/to/repo
Zálohovaný server
borg init --encryption repokey backup@domain.internal:/path/to/repo
borgbackup.sh
#!/bin/sh
REPOSITORY=$1
REPONAME=$2
PATHTOBACKUP=$3
#Bail if borg is already running, maybe previous run didn't finish
if pidof -x borg >/dev/null; then
echo "Backup already running"
exit
fi
borg create -v --stats "$REPOSITORY"::"$REPONAME"'-{now:%Y-%m-%d}' "$PATHTOBACKUP"
# 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 --list "$REPOSITORY" --glob-archives "$REPONAME-*" --keep-daily=7 --keep-weekly=4 --keep-monthly=3
crontab
0 7 * * * BORG_PASSPHRASE= sh borgbackup.sh backup@domain.internal:/path/to/repo reponame /path/to/directory