Script de sauvegarde DiskStation

This commit is contained in:
nyanloutre 2018-08-11 20:19:48 +02:00
commit 3f0fb35573
1 changed files with 43 additions and 0 deletions

43
backup.sh Normal file
View File

@ -0,0 +1,43 @@
#!/bin/sh
# Setting this, so the repo does not need to be given on the commandline:
export BORG_REPO='synology@nyanlout.re:/mnt/backup_loutre/diskstation_borg'
# Setting this, so you won't be asked for your repository passphrase:
export BORG_PASSPHRASE='xxxxxxxxxxxxxxxxxxxxxxxxxx'
echo "Starting backup on $BORG_REPO"
date=$(date "+%Y-%m-%dT%H:%M:%S")
archiveName="diskstation-$date"
basePath='/volume1/Sauvegardes'
# Backup the most important directories into an archive named after
# the machine this script is currently running on:
borg create \
--verbose \
--list \
--stats \
--compression lz4 \
\
::$archiveName \
\
${basePath}/TREHIOU_THINKPAD \
${basePath}/PC_CLAIRE \
${basePath}/TREHIOU_HP
echo "Pruning repository"
# 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 machines' archives also:
borg prune \
--verbose \
--prefix 'diskstation-' \
--keep-daily 7 \
--keep-weekly 4 \
--keep-monthly 6 \