summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2012-02-28 12:29:37 +0000
committerAlexandru Scvortov <alexandru@rabbitmq.com>2012-02-28 12:29:37 +0000
commit4435c748294379add22aca9e3ee7273113daee18 (patch)
tree260b85749a269e21313ff119a07ed3510a333f68 /scripts
parent168c060308e2ccdba8ef6f8e06fe2e87400bc3b4 (diff)
parent5e78aacf560b504834559e7e2b5a1fc9118983bd (diff)
downloadrabbitmq-server-git-4435c748294379add22aca9e3ee7273113daee18.tar.gz
merge bug24650 into default (Move names for connections and channels from mgmt to broker)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/rabbitmq-echopid.bat49
1 files changed, 49 insertions, 0 deletions
diff --git a/scripts/rabbitmq-echopid.bat b/scripts/rabbitmq-echopid.bat
new file mode 100644
index 0000000000..5c652c30c0
--- /dev/null
+++ b/scripts/rabbitmq-echopid.bat
@@ -0,0 +1,49 @@
+@echo off
+
+REM Usage: rabbitmq-echopid.bat <rabbitmq_nodename>
+REM
+REM <rabbitmq_nodename> sname of the erlang node to connect to (required)
+
+setlocal
+
+if "%1"=="" goto fail
+
+:: 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%" (
+ goto fail
+)
+
+:getpid
+for /f "usebackq tokens=* skip=1" %%P IN (`%%WMIC_PATH%% process where "name='erl.exe' and commandline like '%%-sname %1%%'" get processid 2^>nul`) do (
+ set PID=%%P
+ goto echopid
+)
+
+:echopid
+:: check for pid not found ::
+if "%PID%" == "" (
+ PING 127.0.0.1 -n 2 > nul
+ set /a TIMER+=1
+ if %TIMEOUT%==%TIMER% goto fail
+ goto getpid
+)
+
+:: show pid ::
+echo %PID%
+
+:: all done ::
+:ok
+endlocal
+EXIT /B 0
+
+:: something went wrong ::
+:fail
+endlocal
+EXIT /B 1
+
+