确定mosquitto版本

问题描述 投票:0回答:1

我正在寻找一种方法在启动之前确定 mosquitto 的版本。 我当然可以启动它并订阅

$SYS/broker/version

出于安全原因,mosquitto 从 2.0 版本开始需要一个扩展配置文件,我必须根据找到的 mosquitto 版本来生成该文件。

由于我以编程方式启动 mosquitto 进程,因此我不想启动进程、获取版本、退出进程,然后使用不同的配置文件重新启动它。

不幸的是,mosquitto.exe 不包含任何版本信息,因此

GetFileVersionInfo
不起作用。

还有其他可靠的信息可以确定它是否是低于或大于2.0的版本吗?

mosquitto
1个回答
10
投票

这是怎么回事

mosquitto -h
它在第一行输出版本信息然后自己退出:

$ mosquitto -h
mosquitto version 2.0.12

mosquitto is an MQTT v5.0/v3.1.1/v3.1 broker.

Usage: mosquitto [-c config_file] [-d] [-h] [-p port]

 -c : specify the broker config file.
 -d : put the broker into the background after starting.
 -h : display this help.
 -p : start the broker listening on the specified port.
      Not recommended in conjunction with the -c option.
 -v : verbose mode - enable all logging types. This overrides
      any logging options given in the config file.

See https://mosquitto.org/ for more information.

您也可以每次生成一个有效的 2.0 配置文件,因为这仍然适用于早期版本的 Mosquitto。

© www.soinside.com 2019 - 2024. All rights reserved.