Skip to content

Commit 787cb2e

Browse files
committed
Add --keep-running option to analyze.sh
1 parent 4e02d26 commit 787cb2e

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

scripts/analysis/analyze.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ LOG_GROUP_END=${LOG_GROUP_END:-"::endgroup::"} # Prefix to end a log group. Defa
5050

5151
# Function to display script usage
5252
usage() {
53-
echo "Usage: $0 [--report <All (default), Csv, Jupyter, Python, Visualization...>] [--profile <Default, Neo4jv5, Neo4jv4,...>] [--domain <domain-name>] [--explore]"
53+
echo "Usage: $0 [--report <All (default), Csv, Jupyter, Python, Visualization...>] [--profile <Default, Neo4jv5, Neo4jv4,...>] [--domain <domain-name>] [--explore] [--keep-running]"
5454
exit 1
5555
}
5656

@@ -59,6 +59,7 @@ analysisReportCompilation="All"
5959
settingsProfile="Default"
6060
selectedAnalysisDomain=""
6161
exploreMode=false
62+
keepRunning=false
6263

6364
# Function to check if a parameter value is missing (either empty or another option starting with --)
6465
is_missing_value_parameter() {
@@ -92,6 +93,10 @@ while [[ $# -gt 0 ]]; do
9293
exploreMode=true
9394
shift
9495
;;
96+
--keep-running)
97+
keepRunning=true
98+
shift
99+
;;
95100
--domain)
96101
if is_missing_value_parameter "$1" "$2"; then
97102
echo "analyze: Error: --domain requires a value."
@@ -141,6 +146,12 @@ echo "analyze: analysisReportCompilation=${analysisReportCompilation}"
141146
echo "analyze: settingsProfile=${settingsProfile}"
142147
echo "analyze: selectedAnalysisDomain=${selectedAnalysisDomain}"
143148
echo "analyze: exploreMode=${exploreMode}"
149+
echo "analyze: keepRunning=${keepRunning}"
150+
151+
# Print warning if --explore and --keep-running are used together
152+
if ${exploreMode} && ${keepRunning}; then
153+
echo "analyze: Warning: --explore implies --keep-running. The --keep-running option is redundant."
154+
fi
144155

145156
## Get this "scripts/analysis" directory if not already set
146157
# Even if $BASH_SOURCE is made for Bourne-like shells it is also supported by others and therefore here the preferred solution.
@@ -217,7 +228,11 @@ fi
217228
#########################
218229
source "${REPORT_COMPILATION_SCRIPT}"
219230

220-
# Stop Neo4j at the end
231+
# Stop Neo4j at the end (unless --keep-running is set)
221232
echo "${LOG_GROUP_START}Finishing Analysis"
222-
source "${SCRIPTS_DIR}/stopNeo4j.sh"
233+
if ${keepRunning}; then
234+
echo "analyze: Neo4j will keep running (--keep-running is set)."
235+
else
236+
source "${SCRIPTS_DIR}/stopNeo4j.sh"
237+
fi
223238
echo "${LOG_GROUP_END}"

0 commit comments

Comments
 (0)