wait_for_server.sh 374 B

123456789101112131415161718
  1. #!/usr/bin/env bash
  2. counter=0
  3. status=""
  4. until [[ $status = "false" ]]; do
  5. status=$(curl 2>/dev/null "http://$1/status.php" | jq .maintenance)
  6. if [[ "$status" =~ "false" || "$status" = "" ]]; then
  7. let "counter += 1"
  8. if [[ $counter -gt 2 ]]; then
  9. echo "Failed to wait for server"
  10. exit 1
  11. fi
  12. fi
  13. sleep 10
  14. done