nextcloud-android/scripts/wait_for_server.sh

24 lines
482 B
Bash
Raw Normal View History

#!/usr/bin/env bash
status=""
counter=0
checkcounter=0
until [[ $status = "false" ]]; do
status=$(curl 2>/dev/null "http://$1/status.php" | jq .maintenance)
echo "($checkcounter) $status"
if [[ "$status" =~ "false" || "$status" = "" ]]; then
let "counter += 1"
if [[ $counter -gt 50 ]]; then
echo "Failed to wait for server"
exit 1
fi
fi
let "checkcounter += 1"
sleep 10
done
echo "($checkcounter) Done"