forked from prodrigestivill/docker-postgres-backup-local
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement hooks with run-parts prodrigestivill#58
- Loading branch information
1 parent
1f46aba
commit 67ecbb1
Showing
5 changed files
with
61 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# Possible actions: error, pre-backup, post-backup | ||
ACTION="${1}" | ||
|
||
if [ "${WEBHOOK_URL}" != "**None**" ]; then | ||
case "${ACTION}" in | ||
"error") | ||
echo "Execute error webhook call to ${WEBHOOK_URL}" | ||
curl --request POST \ | ||
--url "${WEBHOOK_URL}" \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"status": "error"}' \ | ||
--max-time 10 \ | ||
--retry 5 \ | ||
${WEBHOOK_EXTRA_ARGS} | ||
;; | ||
# "pre-backup") | ||
# echo "Nothing to do" | ||
# ;; | ||
"post-backup") | ||
echo "Execute post-backup webhook call to ${WEBHOOK_URL}" | ||
curl --request POST \ | ||
--url "${WEBHOOK_URL}" \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"status": "post-backup"}' \ | ||
--max-time 10 \ | ||
--retry 5 \ | ||
${WEBHOOK_EXTRA_ARGS} | ||
;; | ||
esac | ||
fi |