Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Mosquitto » Problem starting mosquitto automatically
Problem starting mosquitto automatically [message #1749226] Sat, 03 December 2016 17:07 Go to next message
Anthony McDonald is currently offline Anthony McDonaldFriend
Messages: 2
Registered: December 2016
Junior Member
Just installed Mosquitto on my Raspberry Pi. I used the Add/Remove Software from the Preferences Menu to install Mosquitto and the command line utilities.

Works OK when run directly from the command line. Trying to start using systemctl fails.
pi@raspberrypi:/etc/mosquitto/conf.d $ sudo systemctl start mosquitto
pi@raspberrypi:/etc/mosquitto/conf.d $ sudo systemctl status mosquitto
‚óŹ mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto)
Active: active (exited) since Sat 2016-12-03 17:02:04 GMT; 3min 22s ago
Process: 4787 ExecStop=/etc/init.d/mosquitto stop (code=exited, status=0/SUCCESS)
Process: 5538 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUCCESS)

Dec 03 17:02:04 raspberrypi mosquitto[5538]: Starting network daemon:: mosquitto.
Dec 03 17:02:04 raspberrypi systemd[1]: Started LSB: mosquitto MQTT v3.1 message broker.
Dec 03 17:04:12 raspberrypi systemd[1]: Started LSB: mosquitto MQTT v3.1 message broker.
Dec 03 17:05:01 raspberrypi systemd[1]: Started LSB: mosquitto MQTT v3.1 message broker.
Dec 03 17:05:25 raspberrypi systemd[1]: Started LSB: mosquitto MQTT v3.1 message broker.

Any ideas?
Re: Problem starting mosquitto automatically [message #1749545 is a reply to message #1749226] Thu, 08 December 2016 01:34 Go to previous messageGo to next message
sahin mersin is currently offline sahin mersinFriend
Messages: 1
Registered: December 2016
Junior Member
FernandoGarcia thanks.

The solution is:

sudo update-rc.d mosquitto remove

sudo nano /etc/systemd/system/mosquitto.service

Paste and save this script

[Unit]
Description=Mosquitto MQTT Broker
Documentation=man:mosquitto(Cool
Documentation=man:mosquitto.conf(5)
ConditionPathExists=/etc/mosquitto/mosquitto.conf
After=xdk-daemon.service

[Service]
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
ExecReload=/bin/kill -HUP $MAINPID
User=mosquitto
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
sudo systemctl enable mosquitto.service
sudo reboot

check if mosquitto is running

sudo mosquitto -v

Re: Problem starting mosquitto automatically [message #1749621 is a reply to message #1749545] Thu, 08 December 2016 17:08 Go to previous message
Anthony McDonald is currently offline Anthony McDonaldFriend
Messages: 2
Registered: December 2016
Junior Member
Thanks for the response. It mysteriously starting working after last reboot last night. Previous reboots didn't help. Very odd.
Previous Topic:Problem in receiving data in MQTT paho C
Next Topic:Unable to connect to Mosquitto over Websocket
Goto Forum:
  


Current Time: Fri Sep 21 14:01:43 GMT 2018

Powered by FUDForum. Page generated in 0.02060 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top