nextcloud-android/scripts/wait_for_server.sh
Andy Scherzinger e3d57e7c42
Update SPDX header to reflect correct state
Resolves #12920

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-04-30 12:18:45 +02:00

24 lines
619 B
Bash
Executable file

#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2019-2020 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
counter=0
status=""
until [[ $status = "false" ]]; do
status=$(curl 2>/dev/null "http://$1/status.php" | jq .maintenance)
echo "($counter) $status"
if [[ "$status" =~ "false" || "$status" = "" ]]; then
let "counter += 1"
if [[ $counter -gt 50 ]]; then
echo "Failed to wait for server"
exit 1
fi
fi
sleep 10
done