test_shutdown.sh 620 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. RAILS_ENV=$1
  3. APP_PORT=$2
  4. WS_PORT=$3
  5. EXIT=$4 || 0
  6. WITH_DB=$5 || 0
  7. SERVER_PID='tmp/pids/server.pid'
  8. LOG_HOST='cilog@schneeberg.znuny.com'
  9. bundle exec script/scheduler.rb stop
  10. bundle exec script/websocket-server.rb stop
  11. kill $(cat $SERVER_PID)
  12. sleep 5
  13. if [ -f $SERVER_PID ]; then
  14. kill -9 $(cat $SERVER_PID)
  15. fi
  16. if test $WITH_DB -eq 1; then
  17. script/build/test_cleanup.sh
  18. fi
  19. # if build has failed, copy logs for analyzing
  20. if test $EXIT -eq 1; then
  21. ssh $LOG_HOST "mkdir -p logs/$CI_BUILD_ID"
  22. scp -C log/* $LOG_HOST:logs/$CI_BUILD_ID/
  23. scp -C tmp/screenshot* $LOG_HOST:logs/$CI_BUILD_ID/
  24. fi
  25. exit $EXIT