重新启动蚊帐 [英] Restarting the mosquito broker
问题描述
我已经使用brew install mosquitto
在我的Mac上安装了mosquito代理.
I have installed mosquito broker on my mac using brew install mosquitto
.
通常,我不提供任何命令来启动mosquitto服务器.当我打开Mac时,它会自动启动.
Normally I don't give any commands to start the mosquitto server. It is started automatically when I switch on my mac.
我已经通过使用命令ps -ef | grep mosquitto
验证了它正在运行,该命令给出了以下输出
I have verified that it is running by using the command ps -ef | grep mosquitto
, which gives the following output
501 209 153 0 2:20PM ?? 0:06.93/usr/local/opt/mosquitto/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf
501 2559 1007 0 10:36AM ttys001 0:00.00 grep mosquitto
501 865 815 0 2:32PM ttys003 0:00.86 mosquitto_sub -h 127.0.0.1 -t esb.test2
然后我通过使用kill -9 above-pid
杀死mosquitto进程来停止服务器.
Then I stopped the server by killing the mosquitto process using kill -9 above-pid
.
现在,我想知道如何从命令行重新启动服务器,但又不重新启动Mac.
Now I would like to know how can I restart the server again from command line, but without restarting my mac.
推荐答案
如果您是从自制软件安装的mosquitto,则可以使用launchctl来控制服务,例如
If you've installed mosquitto from homebrew, you can use launchctl to control the service, e.g.
$ launchctl load /usr/local/Cellar/mosquitto/1.4.2/homebrew.mxcl.mosquitto.plist
$ launchctl unload /usr/local/Cellar/mosquitto/1.4.2/homebrew.mxcl.mosquitto.plist
$ launchctl start homebrew.mxcl.mosquitto
$ launchctl stop homebrew.mxcl.mosquitto
这篇关于重新启动蚊帐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!