123456789101112131415161718192021 |
- #!/bin/sh -xe
- # Init restic repository if neccessary
- restic snapshots &>/dev/null || restic init
- # Notify prometheus on backup start if $PROM_GW_URL is set
- /root/restic/notify-prom-status.sh start
- # Run backup job, using parameters from AWS_ACCESS_KEY_ID,
- # AWS_SECRET_ACCESS_KEY, RESTIC_PASSWORD, RESTIC_REPOSITORY
- restic backup $RESTIC_BACKUP_ARGS $RESTIC_BACKUP_FOLDERS
- case $? in
- 0) /root/restic/notify-prom-status.sh stop
- /root/restic/notify-prom-stats.sh ;;
- 3) /root/restic/notify-prom-status.sh incomplete ;;
- 1|*) /root/restic/notify-prom-status.sh fail ;;
- esac
-
- # Cleanup old backups
- restic forget $RESTIC_FORGET_ARGS
|