Skip to content

Commit ba598d5

Browse files
committed
Cleanup logs
1 parent fc73697 commit ba598d5

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

backup.sh

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
#!/bin/sh
22

3-
echo "Starting Backup"
3+
echo "Starting Backup" >> /var/log/cron.log
44

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
613

714
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
1024
fi

build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22

3-
docker build --rm -t backup-test .
3+
docker build --rm -t restic-backup .

run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ docker run --privileged --name backup-test \
1010
-e "BACKUP_CRON=* * * * *" \
1111
-v ~/test-data:/data \
1212
-v ~/test-repo/:/mnt/restic \
13-
-t backup-test
13+
-t restic-backup
1414

1515

0 commit comments

Comments
 (0)