mirror of
https://github.com/prodrigestivill/docker-postgres-backup-local.git
synced 2026-06-02 01:27:59 +00:00
Implement hooks with run-parts #58
This commit is contained in:
Executable
+34
@@ -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
|
||||
Reference in New Issue
Block a user