Files
nextcloud-android-library/scripts/wait_for_server.sh
Andy Scherzinger cbdba43396 Further SPDX header / license definition
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-03-01 20:00:59 +01:00

25 lines
601 B
Bash
Executable File

#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2017 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: GPL-3.0-or-later
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