-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SONAR-10690 start.sh, stop.sh & logs.sh support SQ editions
- Loading branch information
Showing
6 changed files
with
151 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
DEFAULT_EDITION="oss" | ||
EDITIONS="oss" | ||
|
||
function toLower() { | ||
echo "$1" | tr '[:upper:]' '[:lower:]' | ||
} | ||
|
||
function checkEditionArgument() { | ||
local editionArg="$1" | ||
local lowerEditionArg=$(toLower $editionArg) | ||
|
||
if [ "$lowerEditionArg" == "$DEFAULT_EDITION" ]; then | ||
return | ||
fi | ||
|
||
for t in $EDITIONS; do | ||
if [ "$lowerEditionArg" == "$t" ]; then | ||
return | ||
fi | ||
done | ||
|
||
echo "Unsupported edition $editionArg" | ||
exit 1 | ||
} | ||
|
||
function distributionDirOf() { | ||
local edition="$1" | ||
|
||
if [ "$edition" = "oss" ]; then | ||
echo "sonar-application/build/distributions/" | ||
else | ||
echo "unsupported edition $edition" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function baseFileNameOf() { | ||
local edition="$1" | ||
|
||
if [ "$edition" = "oss" ]; then | ||
echo "sonar-application" | ||
else | ||
echo "unsupported edition $edition" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function targetDirOf() { | ||
local edition="$1" | ||
|
||
if [ "$edition" = "oss" ]; then | ||
echo "sonarqube-oss" | ||
else | ||
echo "unsupported edition $edition" | ||
exit 1 | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
############################### | ||
# Shortcut to stop server. It must be already built. | ||
############################### | ||
|
||
set -euo pipefail | ||
|
||
ROOT=$(pwd) | ||
source "$ROOT/scripts/editions.sh" | ||
if [ -r "$ROOT/private/scripts/editions.sh" ]; then | ||
source "$ROOT/private/scripts/editions.sh" | ||
fi | ||
|
||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
OS='macosx-universal-64' | ||
else | ||
OS='linux-x86-64' | ||
fi | ||
|
||
function stopAny() { | ||
for edition in $EDITIONS; do | ||
SONAR_SH="$(distributionDirOf "$edition")/$(targetDirOf "$edition")/sonarqube-*/bin/$OS/sonar.sh" | ||
if ls $SONAR_SH &> /dev/null; then | ||
echo "$(targetDirOf "$edition") is unpacked" | ||
sh $SONAR_SH stop | ||
fi | ||
done | ||
} | ||
|
||
# check the script was called to avoid execute when script is only sourced | ||
script_name=$(basename "$0") | ||
if [ "$script_name" == "stop.sh" ]; then | ||
stopAny | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
scripts/stop.sh |