I’m looking for a way to determine mosquitto’s version BEFORE starting it.
Of course I could start it and subscribe to
For security reasons mosquitto needs an extended configuration file since version 2.0, which I have to generate depending on the found mosquitto version.
Since I’m starting a mosquitto process programmatically, I don’t want to start a process, get the version, quit the process, and restart it with a different config file.
Unfortunately, the mosquitto.exe doesn’t contain any version information, so
GetFileVersionInfo does not work.
Is there any other reliable information to find out if it’s a version less oder greater than 2.0?
What’s wrong with
mosquitto -h it outputs the version information in the first line and then exit on it’s own:
$ 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.
Also you could just generate a valid 2.0 config file every time as this will still work with earlier versions of Mosquitto.