Skip to content

Commit

Permalink
Merge pull request #21 from avoinsystems/feat-healthchecks
Browse files Browse the repository at this point in the history
[FEAT] Allow calling a healthcheck URL after a successful backup
  • Loading branch information
skomma committed Sep 15, 2019
2 parents f036b1a + 3af7425 commit d872f38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ Environment variables
| MONGODB_AUTHDB | Authentication DB name | - |
| CRONMODE | If set "true", this container is executed in cron mode. In cron mode, the script will be executed with the specified arguments and at the time specified by CRON_EXPRESSION. | "false" |
| CRON_EXPRESSION | Cron expression (ex. "CRON_EXPRESSION=0 4 * * *" if you want to run at 4:00 every day) | - |
| HEALTHCHECKS_URL | URL that gets called after a successful backup (eg. https://healthchecks.io) | - |
### For `restore`
Expand Down
5 changes: 5 additions & 0 deletions bin/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ elif [ `echo $TARGET_BUCKET_URL | cut -f1 -d":"` == "gs" ]; then
gs_copy_file ${TARBALL_FULLPATH} ${TARGET_BUCKET_URL}
fi

# call healthchecks url for successful backup
if [ "x${HEALTHCHECKS_URL}" != "x" ]; then
curl -fsS --retry 3 ${HEALTHCHECKS_URL} > /dev/null
fi

# clean up working files if in cron mode
if ${CRONMODE} ; then
rm -rf ${TARGET}
Expand Down

0 comments on commit d872f38

Please sign in to comment.