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 | a2155beae6226179cc6551cd1b36622ac87b0653 (patch) | |
tree | f07ab389fa2ed1bf7aa6d7a42be6d8e58a150166 | |
parent | 173a6f2b0d85332ab71c6a113f69b99f559265fe (diff) | |
download | rabbitmq-server-a2155beae6226179cc6551cd1b36622ac87b0653.tar.gz |
First attempt at writing out erl pid on win; not pretty, not fully tested, but it seems to work
-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 c27b418a..73096b96 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
|