test.sh 513 B

12345678910111213141516171819
  1. #!/bin/bash
  2. echo -ne 'Launching Algernon...\t'
  3. ./algernon --quiet --httponly --server --nodb --addr :45678 &
  4. PID=$!
  5. function finish {
  6. echo -ne "Stopping PID $PID...\t"
  7. kill $PID 2>/dev/null && echo ok || echo fail
  8. }
  9. trap finish EXIT
  10. echo ok
  11. echo -ne 'Waiting for response...\t'
  12. for i in $(seq 1 30); do curl -sIm3 -o/dev/null http://localhost:45678 && break || sleep 1; done
  13. output=$(curl -sIm3 -o- http://localhost:45678)
  14. if [[ $output == *"Server: Algernon"* ]]; then
  15. echo ok
  16. else
  17. echo fail
  18. exit 1
  19. fi