Initial commit
This commit is contained in:
commit
ef74f5534d
6 changed files with 44 additions and 0 deletions
9
backup.sh
Executable file
9
backup.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
exec &>>/var/log/restic.log
|
||||
source /etc/restic/restic_env.sh
|
||||
cd ${BACKUP_ROOT}
|
||||
date +"%h %e %T $HOSTNAME restic $$[$BASHPID]: Starting backup"
|
||||
restic backup --exclude-file /etc/restic/excludes.txt .
|
||||
date +"%h %e %T $HOSTNAME restic $$[$BASHPID]: Pruning old files"
|
||||
restic prune >> /var/log/restic.log
|
||||
date +"%h %e %T $HOSTNAME restic $$[$BASHPID]: Backup complete"
|
11
excludes.txt
Normal file
11
excludes.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
.*
|
||||
!.profile.d
|
||||
!.qlcplus
|
||||
!.ssh
|
||||
!.github
|
||||
.git
|
||||
*.bak
|
||||
Music
|
||||
*.old
|
||||
BL-*
|
||||
Downloads
|
1
passwd
Normal file
1
passwd
Normal file
|
@ -0,0 +1 @@
|
|||
PutASuperSecurePasswordHere
|
7
restic.service
Normal file
7
restic.service
Normal file
|
@ -0,0 +1,7 @@
|
|||
[Unit]
|
||||
Description=Restic Backup
|
||||
|
||||
[Service]
|
||||
Type=exec
|
||||
Restart=no
|
||||
ExecStart=/etc/restic/backup.sh
|
10
restic.timer
Normal file
10
restic.timer
Normal file
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Run backup weekly
|
||||
|
||||
[Timer]
|
||||
OnCalendar=weekly
|
||||
Persistent=true
|
||||
Unit=restic.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
6
restic_env.sh
Executable file
6
restic_env.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
export HOME=/root/
|
||||
export AWS_ACCESS_KEY_ID=<SECRET>
|
||||
export AWS_SECRET_ACCESS_KEY=<SECRET>
|
||||
export RESTIC_REPOSITORY="s3:s3.us-west-000.backblazeb2.com/<BUCKET>"
|
||||
export RESTIC_PASSWORD_FILE=/etc/restic/passwd
|
||||
export BACKUP_ROOT=/home/james
|
Loading…
Reference in a new issue