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.

start.sh 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. ###############################
  3. # usage: start.sh [ -p ARG ]
  4. # -p ARG: name(s) of patch separated by colon (name of patch is filename without extension)
  5. ###############################
  6. ROOT=$(pwd)
  7. PATCHES=""
  8. while getopts ":p:" opt; do
  9. case "$opt" in
  10. p) PATCHES=$OPTARG
  11. ;;
  12. \?)
  13. >&2 echo "Unsupported option $OPTARG"
  14. exit 1
  15. ;;
  16. esac
  17. done
  18. if [[ "$OSTYPE" == "darwin"* ]]; then
  19. OS='macosx-universal-64'
  20. else
  21. OS='linux-x86-64'
  22. fi
  23. ls sonar-application/target/sonarqube-*.zip 1> /dev/null 2>&1
  24. if [ "$?" != "0" ]; then
  25. echo 'Sources are not built'
  26. ./build.sh
  27. fi
  28. cd sonar-application/target/
  29. ls sonarqube-*/bin/$OS/sonar.sh 1> /dev/null 2>&1
  30. if [ "$?" != "0" ]; then
  31. echo "Unzipping SQ..."
  32. unzip -qq sonarqube-*.zip
  33. fi
  34. cd sonarqube-*
  35. # from that point on, strict bash
  36. set -euo pipefail
  37. SQ_HOME=$(pwd)
  38. cd $ROOT
  39. source $ROOT/scripts/patches_utils.sh
  40. SQ_EXEC=$SQ_HOME/bin/$OS/sonar.sh
  41. $SQ_EXEC stop
  42. # invoke patches if at least one was specified
  43. # each patch is passed the path to the SQ instance home directory as first and only argument
  44. if [ "$PATCHES" != "" ]; then
  45. call_patches $PATCHES $SQ_HOME
  46. fi
  47. $SQ_EXEC start
  48. sleep 1
  49. tail -100f $SQ_HOME/logs/sonar.log