Files
nextcloud/Containers/postgresql/healthcheck.sh
2026-05-11 10:10:26 +00:00

18 lines
473 B
Bash

#!/bin/bash
# SPDX-FileCopyrightText: 2023 Nextcloud GmbH <https://nextcloud.com>
# SPDX-License-Identifier: AGPL-3.0-only
if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
set -x
fi
test -f "/mnt/data/backup-is-running" && exit 0
# If database import is running, do not continue with the health check
if nc -z 127.0.0.1 11000; then
exit 0
fi
PGPASSWORD="$POSTGRES_PASSWORD" psql -h 127.0.0.1 -p 5432 -U "oc_$POSTGRES_USER" -d "$POSTGRES_DB" -c "select now()" || exit 1