#!/bin/sh # Possible actions: error, pre-backup, post-backup ACTION="${1}" case "${ACTION}" in "error") if [ "${WEBHOOK_URL}" != "**None**" ]; then 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} fi if [ "${WEBHOOK_ERROR_URL}" != "**None**" ]; then echo "Execute error webhook call to ${WEBHOOK_ERROR_URL}" curl --request POST \ --url "${WEBHOOK_ERROR_URL}" \ --header 'Content-Type: application/json' \ --data '{"status": "error"}' \ --max-time 10 \ --retry 5 \ ${WEBHOOK_EXTRA_ARGS} fi ;; "pre-backup") if [ "${WEBHOOK_PRE_BACKUP_URL}" != "**None**" ]; then echo "Execute pre-backup webhook call to ${WEBHOOK_PRE_BACKUP_URL}" curl --request POST \ --url "${WEBHOOK_PRE_BACKUP_URL}" \ --header 'Content-Type: application/json' \ --data '{"status": "pre-backup"}' \ --max-time 10 \ --retry 5 \ ${WEBHOOK_EXTRA_ARGS} fi ;; "post-backup") if [ "${WEBHOOK_URL}" != "**None**" ]; then 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} fi if [ "${WEBHOOK_POST_BACKUP_URL}" != "**None**" ]; then echo "Execute post-backup webhook call to ${WEBHOOK_POST_BACKUP_URL}" curl --request POST \ --url "${WEBHOOK_POST_BACKUP_URL}" \ --header 'Content-Type: application/json' \ --data '{"status": "post-backup"}' \ --max-time 10 \ --retry 5 \ ${WEBHOOK_EXTRA_ARGS} fi ;; esac