diff options
| author | Jim Apperly <jim@rabbitmq.com> | 2011-12-02 17:24:00 +0000 |
|---|---|---|
| committer | Jim Apperly <jim@rabbitmq.com> | 2011-12-02 17:24:00 +0000 |
| commit | 37c686f4e11c6c3445816509200575dbb1f28e14 (patch) | |
| tree | f07ab389fa2ed1bf7aa6d7a42be6d8e58a150166 /scripts | |
| parent | d297dfbe836b4a02a8f31f2d0acbf3f318063e1b (diff) | |
| download | rabbitmq-server-git-37c686f4e11c6c3445816509200575dbb1f28e14.tar.gz | |
First attempt at writing out erl pid on win; not pretty, not fully tested, but it seems to work
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/rabbitmq-server.bat | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/scripts/rabbitmq-server.bat b/scripts/rabbitmq-server.bat index c27b418adb..73096b960e 100755 --- a/scripts/rabbitmq-server.bat +++ b/scripts/rabbitmq-server.bat @@ -123,7 +123,7 @@ if not "!RABBITMQ_NODE_IP_ADDRESS!"=="" ( )
)
-"!ERLANG_HOME!\bin\erl.exe" ^
+start "!RABBITMQ_NODENAME!" "!ERLANG_HOME!\bin\erl.exe" ^
!RABBITMQ_EBIN_PATH! ^
-noinput ^
-boot "!RABBITMQ_BOOT_FILE!" ^
@@ -146,5 +146,49 @@ if not "!RABBITMQ_NODE_IP_ADDRESS!"=="" ( !RABBITMQ_SERVER_START_ARGS! ^
!STAR!
+:: pid file ::
+set PID_FILE=%RABBITMQ_BASE%\pid.txt
+echo pidfile is "%PID_FILE%"
+
+if exist "%PID_FILE%" (
+ del /f "%PID_FILE%"
+)
+
+
+:: check that wmic exists ::
+set WMIC_PATH=%SYSTEMROOT%\System32\Wbem\wmic.exe
+if not exist "%WMIC_PATH%" (
+ echo "%WMIC_PATH%" not found.
+ goto :wmic_end
+)
+
+:: declare node name ::
+set RABBITMQ_NODENAME_CLI=-sname %RABBITMQ_NODENAME%
+
+:: show ::
+echo sname is %RABBITMQ_NODENAME%
+
+FOR /F "usebackq tokens=* skip=1" %%P IN (`%%WMIC_PATH%% process where "name='erl.exe' and commandline like '%%%RABBITMQ_NODENAME_CLI%%%'" get processid`) do (
+ SET PID=%%P
+ goto :wmic_writepid
+)
+
+:wmic_writepid
+
+:: check for pid not found ::
+if "%PID%" == "" (
+ echo Could not find erl.exe pid
+ goto :wmic_end
+)
+
+:: show ::
+echo erl.exe pid is %PID%
+
+:: write to file ::
+echo %PID% > "%PID_FILE%"
+
+:: all done ::
+:wmic_end
+
endlocal
endlocal
|
