lgrt-backup-solution/backup.sh
2021-01-27 21:50:01 +01:00

46 lines
1,001 B
Bash
Executable file

#!/bin/bash
# Inspired by: https://thomas-leister.de/server-backups-mit-borg/
LOG="backup.log"
HOST="fancy-hostname"
export REPOSITORY="ssh://<user>@<hostname>:<port>/some/example/path/"${HOST}
export BORG_PASSPHRASE=""
exec > >(tee -i ${LOG})
exec 2>&1
echo "###### Starting backup on $(date) ######"
##
## Creating database backup
##
#echo "###### Creating database backup ######"
#/home/serverbackup/backup/dbdump.sh
##
## Backup list of installed software
pacman -Qq > /root/backup/software.list
borg create -v --stats --progress \
$REPOSITORY::'{now:%Y-%m-%d_%H:%M}' \
/root/backup \
/home/user/ \
/home/user/.config \
/home/user/.thunderbird \
/home/user/.wireguard \
/home/user/.ssh \
/home/user/.vim \
/home/user/.mozilla \
/home/user/. \
/etc \
--exclude-caches \
-e /home/user/Downloads \
-e /home/user/vmware \
-e /home/user/Virtualbox\ VMs \
-e /home/user/Nextcloud\* \
-e /home/user/Videos \
-e /home/user/.\* \
echo "###### Finished backup on $(date) ######"