-
Notifications
You must be signed in to change notification settings - Fork 0
/
home_backup.sh
executable file
·31 lines (25 loc) · 1013 Bytes
/
home_backup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# This script is intended to run backups of relevant data under my home folder.
# It uses restic tool (written in Go, see: https://github.com/restic/restic) as
# a backend to save everything under /home/{user}, with the exception of some
# files, specified in a dedicated listing file.
# A configuration is also set to choose a snapshot conservation policy (future feature).
USER=Aand
HDD_NAME=Åsgard
REPO_DIR=rivendell
LOCAL_DEST=/run/media/${USER}/${HDD_NAME}/Backups/${REPO_DIR}
# SFTP_URL=
# AWS_URL=
SAVE_FOLDER=/home/${USER}/
# An exclusion file must be located in the same folder as this script
EXCL_FILE=restic_exclude
TAG=rivendell_home
OPT=
echo "Checking integrity of previous snapshots..."
restic -r $LOCAL_DEST check
# If something went wrong during sanity check, there is no need to go further
if [[ $? == 0 ]]; then
exit $?
fi
echo "Saving $SAVE_FOLDER folder into $LOCAL_DEST with tag $TAG..."
restic -r $LOCAL_DEST backup $SAVE_FOLDER --exclude-file=$EXCL_FILE --tag $TAG