Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restarting the mosquito broker

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

Normally I don't give any commands to start the mosquitto server. It is started automatically when I switch on my mac.

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

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

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

like image 675
Elilmatha Sivanesan Avatar asked Jun 25 '15 09:06

Elilmatha Sivanesan


2 Answers

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
like image 138
Andy Piper Avatar answered Oct 02 '22 01:10

Andy Piper


You could kill the mosquitto process using the steps detailed in the answer here, then restart it in the same way you did originally.

To summarise the answer

killall mosquitto

Should do the job to stop the existing process.

like image 30
ralight Avatar answered Oct 02 '22 02:10

ralight