bat脚本判断rocketmq的namesrv和broker是否启动
时间: 2023-10-08 17:11:42 浏览: 145
bat脚本,用于启动发出某个信号
可以使用以下的bat脚本来检查RocketMQ的namesrv和broker是否启动:
```
@echo off
set NAMESRV=localhost:9876
set BROKER=localhost:10911
echo Checking RocketMQ Namesrv...
netstat -ano | findstr %NAMESRV% | findstr /i "listening" >nul
if %errorlevel%==0 (
echo RocketMQ Namesrv is running.
) else (
echo RocketMQ Namesrv is not running.
)
echo Checking RocketMQ Broker...
netstat -ano | findstr %BROKER% | findstr /i "listening" >nul
if %errorlevel%==0 (
echo RocketMQ Broker is running.
) else (
echo RocketMQ Broker is not running.
)
```
在脚本中,通过netstat命令检查名为%NAMESRV%和%BROKER%的进程是否在监听状态,如果进程在监听状态则代表进程已经启动。如果进程没有在监听状态,则代表进程没有启动。
阅读全文