Restarting a mosquito broker

I installed a mosquito broker on my mac using brew install mosquitto .

Usually I do not give any commands to start the mosquitto server. It starts automatically when my mac is turned on.

I checked that it works with the ps -ef | grep mosquitto 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 

Then I stopped the server by killing the mosquito process using kill -9 above-pid .

Now I would like to know how to restart the server again from the command line, but without restarting my mac.

+6
source share
2 answers

If you installed mosquitto from homebrew, you can use launchctl to manage the service, for example.

 $ 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 
+7
source

You can kill the mosquito process using the steps described in the answer here , and then restart it the same way you originally did.

To summarize the answer

 killall mosquitto 

The task must be completed to stop the existing process.

+1
source

Source: https://habr.com/ru/post/989734/


All Articles