Recette pour la création de l'image sabnzbd
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
716 B

3 years ago
  1. #!/usr/bin/env bash
  2. #
  3. # Simple test script that sees if the SABnzbd server is up within a certain number
  4. # of seconds (TOTAL_ATTEMPTS * SLEEP_TIME). If it isn't up in time or the HTTP
  5. # code returned is not 200, then it exits out with an error code.
  6. TOTAL_ATTEMPTS=10
  7. SLEEP_TIME=6
  8. function connect_server {
  9. http_code=$(curl -sL -w "%{http_code}\\n" "http://localhost:8080/" -o /dev/null)
  10. curl_exit=$?
  11. }
  12. attempts=0
  13. until [ $attempts -ge $TOTAL_ATTEMPTS ]
  14. do
  15. connect_server
  16. [ "$curl_exit" == "0" ] && break
  17. attempts=$[$attempts+1]
  18. sleep $SLEEP_TIME
  19. done
  20. if [ "$http_code" != "200" ]
  21. then
  22. echo "Received HTTP $http_code from SABnzbd port (last curl exit code: $curl_exit)"
  23. exit 1
  24. fi