summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Apperly <jim@rabbitmq.com>2012-02-15 15:57:00 +0000
committerJim Apperly <jim@rabbitmq.com>2012-02-15 15:57:00 +0000
commit7bef1d366453052097344f496c55cb53e787414e (patch)
tree5fb3a27efe536d0c5c4f7fabca46b944bddb3798
parent5e980d7f502405fd5f7f22a50c8f1753e5f8fd75 (diff)
downloadrabbitmq-server-7bef1d366453052097344f496c55cb53e787414e.tar.gz
Implement basic timeout when waiting for the pid
-rw-r--r--scripts/rabbitmq-echopid.bat8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/rabbitmq-echopid.bat b/scripts/rabbitmq-echopid.bat
index ae8c1ded..cc68d0f9 100644
--- a/scripts/rabbitmq-echopid.bat
+++ b/scripts/rabbitmq-echopid.bat
@@ -11,6 +11,10 @@ if "%1"=="" goto wmic_fail
:: set the node name ::
set NODENAME="%1"
+:: set timeout vars ::
+set TIMEOUT=10
+set TIMER=1
+
:: check that wmic exists ::
set WMIC_PATH=%SYSTEMROOT%\System32\Wbem\wmic.exe
if not exist "%WMIC_PATH%" (
@@ -21,7 +25,7 @@ if not exist "%WMIC_PATH%" (
set RABBITMQ_NODENAME_CLI=-sname %1
:wmic_getpid
-for /F "usebackq tokens=* skip=1" %%P IN (`%%WMIC_PATH%% process where "name='erl.exe' and commandline like '%%%RABBITMQ_NODENAME_CLI%%%'" get processid 2^>nul`) do (
+for /f "usebackq tokens=* skip=1" %%P IN (`%%WMIC_PATH%% process where "name='erl.exe' and commandline like '%%%RABBITMQ_NODENAME_CLI%%%'" get processid 2^>nul`) do (
set PID=%%P
goto wmic_echopid
)
@@ -30,6 +34,8 @@ for /F "usebackq tokens=* skip=1" %%P IN (`%%WMIC_PATH%% process where "name='er
:: check for pid not found ::
if "%PID%" == "" (
PING 127.0.0.1 -n 2 > nul
+ set /a TIMER+=1
+ if %TIMEOUT%==%TIMER% goto wmic_fail
goto wmic_getpid
)