forked from prodrigestivill/docker-postgres-backup-local
-
Notifications
You must be signed in to change notification settings - Fork 0
/
00-webhook
executable file
·34 lines (31 loc) · 845 Bytes
/
00-webhook
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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