Allow spaces in sample script folder for Windows
Change-Id: I74da9e032ccf9d5f13f6352b6f5d48650b9ab63b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1545
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat b/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
index 74ca87e..fce27a9 100644
--- a/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
+++ b/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
@@ -64,17 +64,17 @@
echo INSTALLDIR=%INSTALLDIR%
echo LOGSDIR=%LOGSDIR%
echo.
-cd %CLUSTERDIR%
-if NOT EXIST %LOGSDIR% (
- mkdir %LOGSDIR%
+cd "%CLUSTERDIR%"
+if NOT EXIST "%LOGSDIR%" (
+ mkdir "%LOGSDIR%"
)
-call %INSTALLDIR%\bin\${HELPER_COMMAND} get_cluster_state -quiet
+call "%INSTALLDIR%\bin\${HELPER_COMMAND}" get_cluster_state -quiet
IF %ERRORLEVEL% EQU 0 (
echo ERROR: sample cluster address [localhost:${LISTEN_PORT}] already in use
goto :ERROR
)
-set tempfile="%TEMP%\start-sample-cluster-%random%"
+set tempfile=%TEMP%\start-sample-cluster-%random%
wmic process where ^
"name='java.exe' and CommandLine like '%%org.codehaus.mojo.appassembler.booter.AppassemblerBooter%%' and (CommandLine like '%%app.name=\"%%[cn]c\"%%' or CommandLine like '%%app.name=\"%%ncservice\"%%')" ^
@@ -102,24 +102,24 @@
goto :post_timestamp
:timestamp
-if "%1" == "" exit /B 0
echo "--------------------------" >> %1
echo "%date% %time%" >> %1
echo "--------------------------" >> %1
-shift
-goto :timestamp
+exit /B 0
:post_timestamp
echo Starting sample cluster...
-call :timestamp %LOGSDIR%\blue-service.log %LOGSDIR%\red-service.log %LOGSDIR%\cc.log
+call :timestamp "%LOGSDIR%\blue-service.log"
+call :timestamp "%LOGSDIR%\red-service.log"
+call :timestamp "%LOGSDIR%\cc.log"
-start /MIN "blue-nc" cmd /c "echo See output in %LOGSDIR%\blue-service.log && %INSTALLDIR%\bin\${NC_SERVICE_COMMAND} -logdir - -config-file %CLUSTERDIR%\conf\blue.conf >> %LOGSDIR%\blue-service.log 2>&1"
-start /MIN "red-nc" cmd /c "echo See output in %LOGSDIR%\red-service.log && %INSTALLDIR%\bin\${NC_SERVICE_COMMAND} -logdir - >> %LOGSDIR%\red-service.log 2>&1"
-start /MIN "cc" cmd /c "echo See output in %LOGSDIR%\cc.log && %INSTALLDIR%\bin\${CC_COMMAND} -config-file %CLUSTERDIR%\conf\cc.conf >>%LOGSDIR%\cc.log 2>&1"
+start /MIN "blue-nc" cmd /c "echo See output in %LOGSDIR%\blue-service.log && "%INSTALLDIR%\bin\${NC_SERVICE_COMMAND}" -logdir - -config-file "%CLUSTERDIR%\conf\blue.conf" >> "%LOGSDIR%\blue-service.log" 2>&1"
+start /MIN "red-nc" cmd /c "echo See output in %LOGSDIR%\red-service.log && "%INSTALLDIR%\bin\${NC_SERVICE_COMMAND}" -logdir - >> "%LOGSDIR%\red-service.log" 2>&1"
+start /MIN "cc" cmd /c "echo See output in %LOGSDIR%\cc.log && "%INSTALLDIR%\bin\${CC_COMMAND}" -config-file "%CLUSTERDIR%\conf\cc.conf" >>"%LOGSDIR%\cc.log" 2>&1"
echo.
-call %INSTALLDIR%\bin\${HELPER_COMMAND} wait_for_cluster -timeout 30
+call "%INSTALLDIR%\bin\${HELPER_COMMAND}" wait_for_cluster -timeout 30
if %ERRORLEVEL% EQU 0 (
goto :END
)
diff --git a/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.bat b/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.bat
index 6b02174..d71c3b4 100644
--- a/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.bat
+++ b/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.bat
@@ -23,7 +23,7 @@
:usage
echo.
-echo Usage: %~nx0 [-f[orce]]
+echo Usage: %~nx0 [-f[orce]]:
echo.
echo -f[orce] : Forcibly terminates any running ${PRODUCT} processes (after shutting down cluster, if running)
exit /B 0
@@ -67,13 +67,13 @@
set tempfile="%TEMP%\stop-sample-cluster-%random%"
-call %INSTALLDIR%\bin\${HELPER_COMMAND} get_cluster_state -quiet
+call "%INSTALLDIR%\bin\${HELPER_COMMAND}" get_cluster_state -quiet
if %ERRORLEVEL% EQU 1 (
echo WARNING: sample cluster does not appear to be running
goto :post_shutdown
)
-call %INSTALLDIR%\bin\${HELPER_COMMAND} shutdown_cluster_all
-echo INFO: Waiting up for cluster to shutdown...
+call "%INSTALLDIR%\bin\${HELPER_COMMAND}" shutdown_cluster_all
+echo INFO: Waiting for cluster to shutdown...
set tries=0
:wait_loop
@@ -122,3 +122,4 @@
:END
popd
+