mosquitto_pub 配置文件格式
mosquitto_pub config file format
一些 MQTT 代理接受身份验证令牌作为用户名(例如 mqtt.flespi.io)。在man mosquitto_pub
中我发现客户端支持配置文件:
FILES
$XDG_CONFIG_HOME/mosquitto_sub, $HOME/.config/mosquitto_pub
Configuration file for default options.
但是没有关于文件格式的说明。我试过这个:
username=foobar..token
# and
username foobar..token
# and
--username=foobar..token
# and
foobar..token@host.name:port
# and some other
# that I found in https://github.com/eclipse/mosquitto/blob/master/client/client_shared.c
但在所有情况下我都只有
Error: Unknown option '--username.. and so on'.
而且我不太擅长 C-lang.. 谁能告诉我正确的烹饪方法吗?
啊哈,我好像找到了(在我没有测试的最后一个可能的组合中):
# ~/.config/mosquitto_pub
--username <username-or-token>
-h <broker.addre.ss>
# and so on
因此,正确的格式是 带前导破折号 和 不带等号
现在它允许使用短参数列表执行 mosquitto_pub
:
mosquitto_pub -t mydata/update -m 4
一些 MQTT 代理接受身份验证令牌作为用户名(例如 mqtt.flespi.io)。在man mosquitto_pub
中我发现客户端支持配置文件:
FILES
$XDG_CONFIG_HOME/mosquitto_sub, $HOME/.config/mosquitto_pub Configuration file for default options.
但是没有关于文件格式的说明。我试过这个:
username=foobar..token
# and
username foobar..token
# and
--username=foobar..token
# and
foobar..token@host.name:port
# and some other
# that I found in https://github.com/eclipse/mosquitto/blob/master/client/client_shared.c
但在所有情况下我都只有
Error: Unknown option '--username.. and so on'.
而且我不太擅长 C-lang.. 谁能告诉我正确的烹饪方法吗?
啊哈,我好像找到了(在我没有测试的最后一个可能的组合中):
# ~/.config/mosquitto_pub
--username <username-or-token>
-h <broker.addre.ss>
# and so on
因此,正确的格式是 带前导破折号 和 不带等号
现在它允许使用短参数列表执行 mosquitto_pub
:
mosquitto_pub -t mydata/update -m 4