Michael Blow | 8ed6256 | 2016-09-02 13:23:09 -0400 | [diff] [blame] | 1 | @REM ------------------------------------------------------------ |
| 2 | @REM Licensed to the Apache Software Foundation (ASF) under one |
| 3 | @REM or more contributor license agreements. See the NOTICE file |
| 4 | @REM distributed with this work for additional information |
| 5 | @REM regarding copyright ownership. The ASF licenses this file |
| 6 | @REM to you under the Apache License, Version 2.0 (the |
| 7 | @REM "License"); you may not use this file except in compliance |
| 8 | @REM with the License. You may obtain a copy of the License at |
| 9 | @REM |
| 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | @REM |
| 12 | @REM Unless required by applicable law or agreed to in writing, |
| 13 | @REM software distributed under the License is distributed on an |
| 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | @REM KIND, either express or implied. See the License for the |
| 16 | @REM specific language governing permissions and limitations |
| 17 | @REM under the License. |
| 18 | @REM ------------------------------------------------------------ |
| 19 | @echo off |
| 20 | setlocal |
| 21 | if NOT DEFINED JAVA_HOME ( |
| 22 | echo ERROR: JAVA_HOME not defined |
| 23 | goto :ERROR |
| 24 | ) |
| 25 | |
| 26 | REM ensure JAVA_HOME has no spaces nor quotes, since appassembler can't handle them |
Michael Blow | e6bb4aa | 2016-09-19 17:14:12 -0400 | [diff] [blame] | 27 | set JAVA_HOME=%JAVA_HOME:"=% |
| 28 | for %%I in ("%JAVA_HOME%") do ( |
Michael Blow | 8ed6256 | 2016-09-02 13:23:09 -0400 | [diff] [blame] | 29 | set JAVA_HOME=%%~sI |
| 30 | ) |
| 31 | |
| 32 | set DIRNAME=%~dp0 |
| 33 | |
| 34 | pushd %DIRNAME%\.. |
| 35 | set CLUSTERDIR=%cd% |
| 36 | cd %CLUSTERDIR%\..\.. |
| 37 | set INSTALLDIR=%cd% |
| 38 | |
| 39 | call %INSTALLDIR%\bin\${HELPER_COMMAND} get_cluster_state -quiet |
Michael Blow | fdcf055 | 2016-09-25 22:18:27 -0400 | [diff] [blame] | 40 | if %ERRORLEVEL% NEQ 1 ( |
Michael Blow | be706d5 | 2016-09-14 00:34:51 -0400 | [diff] [blame] | 41 | call %INSTALLDIR%\bin\${HELPER_COMMAND} shutdown_cluster_all |
Michael Blow | 8ed6256 | 2016-09-02 13:23:09 -0400 | [diff] [blame] | 42 | ) else ( |
Michael Blow | be706d5 | 2016-09-14 00:34:51 -0400 | [diff] [blame] | 43 | echo WARNING: sample cluster does not appear to be running, will attempt to wait for |
| 44 | echo CCDriver to terminate if running. |
Michael Blow | 8ed6256 | 2016-09-02 13:23:09 -0400 | [diff] [blame] | 45 | ) |
| 46 | echo. |
Michael Blow | 8ed6256 | 2016-09-02 13:23:09 -0400 | [diff] [blame] | 47 | powershell "Write-Host "Waiting for CCDriver to terminate..." -nonewline; do { if ($running) { Start-Sleep 1 }; %JAVA_HOME%\bin\jps.exe -v | select-string -pattern ${CC_COMMAND} -quiet -outvariable running | Out-Null; Write-Host "." -nonewline } while ($running)" |
| 48 | echo .done. |
| 49 | goto :END |
| 50 | :ERROR |
| 51 | echo. |
| 52 | popd |
| 53 | exit /B 1 |
| 54 | |
| 55 | :END |
| 56 | echo. |
| 57 | popd |