mirror of
https://github.com/luzifer-docker/pvc-rsync.git
synced 2024-12-20 11:11:18 +00:00
Add healthcheck-pings
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
d21765fabf
commit
adcaf81a74
1 changed files with 11 additions and 0 deletions
|
@ -10,6 +10,9 @@ set -euo pipefail
|
|||
: ${LOCAL_DIR:=/data} # Where to find the data to backup
|
||||
: ${NAME_SCHEMA:=%Y-%m-%d_%H-%M-%S} # How to name backup dirs, make sure to make it sortable when using KEEP_LAST_N, do not use spaces
|
||||
: ${ONESHOT:=false} # Run only once (backup only), set INTERVAL to 1 to execute directly on start
|
||||
: ${PING_DOWN:=} # Send a ping (HTTP GET) to this URL when an exit-error ocurred
|
||||
: ${PING_MAX_TIME:=5} # Time in seconds to timeout the ping request
|
||||
: ${PING_UP:=} # Send a ping (HTTP GET) to this URL when backup finished successfully
|
||||
: ${REMOTE_HOST:=} # Where to send the backups
|
||||
: ${SKIP_RESTORE_ON:=} # File to check, if exists restore will be skipped
|
||||
: ${SSH_CONFIG_MOUNT:=~/.ssh-dist} # Where to search for ~/.ssh contents to copy into ~/.ssh (Secret mountPath)
|
||||
|
@ -42,6 +45,10 @@ function error() {
|
|||
}
|
||||
|
||||
function exit_error() {
|
||||
if [[ -n $PING_DOWN ]]; then
|
||||
curl -sS -m ${PING_MAX_TIME} -o /dev/null "${PING_DOWN}"
|
||||
fi
|
||||
|
||||
if [[ $EXIT_ON_ERROR == true ]]; then
|
||||
fatal "$@"
|
||||
return 0
|
||||
|
@ -161,6 +168,10 @@ function run_backup() {
|
|||
return 1
|
||||
}
|
||||
|
||||
if [[ -n $PING_UP ]]; then
|
||||
curl -sS -m ${PING_MAX_TIME} -o /dev/null "${PING_UP}"
|
||||
fi
|
||||
|
||||
info "Backup finished."
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue