Skip to content

Commit

Permalink
Cleanup logs
Browse files Browse the repository at this point in the history
  • Loading branch information
niondir committed Nov 28, 2016
1 parent fc73697 commit ba598d5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
22 changes: 18 additions & 4 deletions backup.sh
@@ -1,10 +1,24 @@
#!/bin/sh

echo "Starting Backup"
echo "Starting Backup" >> /var/log/cron.log

restic backup /data --tag=${RESTIC_TAG?"Missing environment variable RESTIC_TAG"} >> /var/log/cron.log
restic backup /data --tag=${RESTIC_TAG?"Missing environment variable RESTIC_TAG"} > /var/log/backup-last.log 2>&1
rc=$?
if [[ $rc == 0 ]]; then
echo "Backup Successfull" >> /var/log/cron.log
else
echo "Backup Failed with Status ${rc}" >> /var/log/cron.log
restic unlock >> /var/log/cron.log 2>&1
fi

if [ -n "${RESTIC_FORGET_ARGS}" ]; then
echo "Forget about old snapshots based on RESTIC_FORGET_ARGS = ${RESTIC_FORGET_ARGS}"
restic forget ${RESTIC_FORGET_ARGS}
echo "Forget about old snapshots based on RESTIC_FORGET_ARGS = ${RESTIC_FORGET_ARGS}" >> /var/log/cron.log
restic forget ${RESTIC_FORGET_ARGS} >> /var/log/backup-last.log 2>&1

if [[ $rc == 0 ]]; then
echo "Forget Successfull" >> /var/log/cron.log
else
echo "Forget Failed with Status ${rc}" >> /var/log/cron.log
restic unlock >> /var/log/cron.log 2>&1
fi
fi
2 changes: 1 addition & 1 deletion build.sh
@@ -1,3 +1,3 @@
#!/bin/sh

docker build --rm -t backup-test .
docker build --rm -t restic-backup .
2 changes: 1 addition & 1 deletion run.sh
Expand Up @@ -10,6 +10,6 @@ docker run --privileged --name backup-test \
-e "BACKUP_CRON=* * * * *" \
-v ~/test-data:/data \
-v ~/test-repo/:/mnt/restic \
-t backup-test
-t restic-backup


0 comments on commit ba598d5

Please sign in to comment.