#!/bin/sh set -e CURL_OPTS="-s" # Check for basic auth if [ -n "$(cat /run/secrets/push_basicauth)" ] then CURL_OPTS="$CURL_OPTS -u $(cat /run/secrets/push_basicauth)" fi if [ -n "$PUSH_PROMETHEUS_URL" ] then push_start_notification="(echo 'backup 1' | curl $CURL_OPTS --data-binary @- $PUSH_PROMETHEUS_URL)" push_success_notification="(echo 'backup 0' | curl $CURL_OPTS --data-binary @- $PUSH_PROMETHEUS_URL)" push_fail_notification="(echo 'backup -1' | curl $CURL_OPTS --data-binary @- $PUSH_PROMETHEUS_URL)" else if [ -n "$PUSH_URL_START" ] then push_start_notification="curl $CURL_OPTS '$PUSH_URL_START'" fi if [ -n "$PUSH_URL_FAIL" ] then push_fail_notification="curl $CURL_OPTS '$PUSH_URL_FAIL'" fi if [ -n "$PUSH_URL_SUCCESS" ] then push_success_notification="curl $CURL_OPTS '$PUSH_URL_SUCCESS'" fi fi eval "$push_start_notification" if [ "$(backup --machine-logs create 2>&1 | tee /tmp/backup.log && (grep -q 'backup finished' /tmp/backup.log))" ] then eval "$push_success_notification" else eval "$push_fail_notification" fi