aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/start.sh
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-01-03 15:41:13 +0100
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-01-03 15:41:42 +0100
commit0ce4d2cae3f68626768adbae446aedcaa363af79 (patch)
tree7e9f25cb811c3978bf4612afcbba6f322d52135c /scripts/start.sh
parentdb1328e1e12a94c565d94a43db203e3d11af3321 (diff)
downloadsonarqube-0ce4d2cae3f68626768adbae446aedcaa363af79.tar.gz
sonarqube-0ce4d2cae3f68626768adbae446aedcaa363af79.zip
[script] add logs.sh + tail all SQ log files in start.sh
Diffstat (limited to 'scripts/start.sh')
-rwxr-xr-xscripts/start.sh25
1 files changed, 18 insertions, 7 deletions
diff --git a/scripts/start.sh b/scripts/start.sh
index a443d58441d..c4fce72fcec 100755
--- a/scripts/start.sh
+++ b/scripts/start.sh
@@ -1,16 +1,26 @@
#!/bin/bash
###############################
-# usage: start.sh [ -p ARG ]
+# usage: start.sh [ -p ARG ] [ -l ARG ]
# -p ARG: name(s) of patch separated by colon (name of patch is filename without extension)
+# -l ARG: name of log file to display.
+# valid values are 'all', 'sonar', 'web', 'ce' and 'es' (case insensitive).
+# default value is 'all'.
###############################
+set -euo pipefail
+
ROOT=$(pwd)
+source "$ROOT"/scripts/logs.sh
+
PATCHES=""
-while getopts ":p:" opt; do
+LOG="$DEFAULT_LOG"
+while getopts ":p:l:" opt; do
case "$opt" in
p) PATCHES=$OPTARG
;;
+ l) LOG=${OPTARG:=$DEFAULT_LOG}
+ ;;
\?)
echo "Unsupported option $OPTARG" >&2
exit 1
@@ -18,7 +28,9 @@ while getopts ":p:" opt; do
esac
done
-if [[ "$OSTYPE" == "darwin"* ]]; then
+checkLogArgument "$LOG"
+
+if [[ "${OSTYPE:-}" == "darwin"* ]]; then
OS='macosx-universal-64'
else
OS='linux-x86-64'
@@ -26,7 +38,7 @@ fi
if ! ls sonar-application/target/sonarqube-*.zip &> /dev/null; then
echo 'Sources are not built'
- ./build.sh
+ "$ROOT"/build.sh
fi
cd sonar-application/target/
@@ -36,8 +48,6 @@ if ! ls sonarqube-*/bin/$OS/sonar.sh &> /dev/null; then
fi
cd sonarqube-*
-# from that point on, strict bash
-set -euo pipefail
SQ_HOME=$(pwd)
cd "$ROOT"
@@ -55,4 +65,5 @@ fi
"$SQ_EXEC" start
sleep 1
-tail -fn 100 "$SQ_HOME"/logs/sonar.log
+doTail "$LOG"
+