File tree 3 files changed +20
-6
lines changed
3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
- echo " Starting Backup"
3
+ echo " Starting Backup" >> /var/log/cron.log
4
4
5
- restic backup /data --tag=${RESTIC_TAG?" Missing environment variable RESTIC_TAG" } >> /var/log/cron.log
5
+ restic backup /data --tag=${RESTIC_TAG?" Missing environment variable RESTIC_TAG" } > /var/log/backup-last.log 2>&1
6
+ rc=$?
7
+ if [[ $rc == 0 ]]; then
8
+ echo " Backup Successfull" >> /var/log/cron.log
9
+ else
10
+ echo " Backup Failed with Status ${rc} " >> /var/log/cron.log
11
+ restic unlock >> /var/log/cron.log 2>&1
12
+ fi
6
13
7
14
if [ -n " ${RESTIC_FORGET_ARGS} " ]; then
8
- echo " Forget about old snapshots based on RESTIC_FORGET_ARGS = ${RESTIC_FORGET_ARGS} "
9
- restic forget ${RESTIC_FORGET_ARGS}
15
+ echo " Forget about old snapshots based on RESTIC_FORGET_ARGS = ${RESTIC_FORGET_ARGS} " >> /var/log/cron.log
16
+ restic forget ${RESTIC_FORGET_ARGS} >> /var/log/backup-last.log 2>&1
17
+
18
+ if [[ $rc == 0 ]]; then
19
+ echo " Forget Successfull" >> /var/log/cron.log
20
+ else
21
+ echo " Forget Failed with Status ${rc} " >> /var/log/cron.log
22
+ restic unlock >> /var/log/cron.log 2>&1
23
+ fi
10
24
fi
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
- docker build --rm -t backup-test .
3
+ docker build --rm -t restic-backup .
Original file line number Diff line number Diff line change @@ -10,6 +10,6 @@ docker run --privileged --name backup-test \
10
10
-e " BACKUP_CRON=* * * * *" \
11
11
-v ~ /test-data:/data \
12
12
-v ~ /test-repo/:/mnt/restic \
13
- -t backup-test
13
+ -t restic-backup
14
14
15
15
You can’t perform that action at this time.
0 commit comments