How do I start Mosquitto MQTT broker on startup in Ubuntu 16.04 The Next CEO of Stack OverflowRun sudo script at startup under 15.04 using 'systemd'MongoDB 3.0.2 won't start after upgrading to Ubuntu 16.04MySQL not working after upgrade from 14.04 to 16.04How to convert this custom upstart job to systemd?Get Apache2 to restart after reboot, ubuntu 16.04Second ssh instance won't start after upgrade to Xenial Xerus - Permission deniedWhy does my systemd service shut down immediately after running?Systemd doesn't restart monit after killInstall Redis-Server on Ubuntu 16.04 LTS minimalsamba not starting from systemctl: timeout
That's an odd coin - I wonder why
Free fall ellipse or parabola?
What steps are necessary to read a Modern SSD in Medieval Europe?
Direct Implications Between USA and UK in Event of No-Deal Brexit
Ising model simulation
Was the Stack Exchange "Happy April Fools" page fitting with the 90s code?
Traveling with my 5 year old daughter (as the father) without the mother from Germany to Mexico
How can a day be of 24 hours?
Can I cast Thunderwave and be at the center of its bottom face, but not be affected by it?
Shortening a title without changing its meaning
How can I prove that a state of equilibrium is unstable?
Is it OK to decorate a log book cover?
Why does the freezing point matter when picking cooler ice packs?
Calculate the Mean mean of two numbers
Read/write a pipe-delimited file line by line with some simple text manipulation
Is a linearly independent set whose span is dense a Schauder basis?
Another proof that dividing by 0 does not exist -- is it right?
How can I separate the number from the unit in argument?
How should I connect my cat5 cable to connectors having an orange-green line?
pgfplots: How to draw a tangent graph below two others?
Why can't we say "I have been having a dog"?
How exploitable/balanced is this homebrew spell: Spell Permanency?
Could a dragon use hot air to help it take off?
Compensation for working overtime on Saturdays
How do I start Mosquitto MQTT broker on startup in Ubuntu 16.04
The Next CEO of Stack OverflowRun sudo script at startup under 15.04 using 'systemd'MongoDB 3.0.2 won't start after upgrading to Ubuntu 16.04MySQL not working after upgrade from 14.04 to 16.04How to convert this custom upstart job to systemd?Get Apache2 to restart after reboot, ubuntu 16.04Second ssh instance won't start after upgrade to Xenial Xerus - Permission deniedWhy does my systemd service shut down immediately after running?Systemd doesn't restart monit after killInstall Redis-Server on Ubuntu 16.04 LTS minimalsamba not starting from systemctl: timeout
I am trying to run a Mosquitto MQTT Broker on Ubuntu 16.04. I have instructions from 14.04, but since 16.04 no longer uses startup, I can't figure out how to convert to systemd.
Here are the commands for 14.04:
description "Mosquitto MQTT broker"
start on net-device-up
respawn
exec /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
EDIT:
This is what I got to so far. When I reboot and run systemctl status mosquitto.service
I show that mosquitto is loaded but not active:
[Unit]
Description=Mosquitto MQTT Broker
[Service]
WorkingDirectory=/usr/sbin/mosquitto
ExecStart=/etc/mosquitto/mosquitto.conf
Restart=always
[Install]
WantedBy=multi-user.target
EDIT 2:
Ran sudo systemctl enable mosquitto.service
. Now the error exit code is:
Process: 1720 ExecStart=/etc/mosquitto/mosquitto.conf (code=exited, status=200/CHDIR)
16.04 systemd
add a comment |
I am trying to run a Mosquitto MQTT Broker on Ubuntu 16.04. I have instructions from 14.04, but since 16.04 no longer uses startup, I can't figure out how to convert to systemd.
Here are the commands for 14.04:
description "Mosquitto MQTT broker"
start on net-device-up
respawn
exec /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
EDIT:
This is what I got to so far. When I reboot and run systemctl status mosquitto.service
I show that mosquitto is loaded but not active:
[Unit]
Description=Mosquitto MQTT Broker
[Service]
WorkingDirectory=/usr/sbin/mosquitto
ExecStart=/etc/mosquitto/mosquitto.conf
Restart=always
[Install]
WantedBy=multi-user.target
EDIT 2:
Ran sudo systemctl enable mosquitto.service
. Now the error exit code is:
Process: 1720 ExecStart=/etc/mosquitto/mosquitto.conf (code=exited, status=200/CHDIR)
16.04 systemd
add a comment |
I am trying to run a Mosquitto MQTT Broker on Ubuntu 16.04. I have instructions from 14.04, but since 16.04 no longer uses startup, I can't figure out how to convert to systemd.
Here are the commands for 14.04:
description "Mosquitto MQTT broker"
start on net-device-up
respawn
exec /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
EDIT:
This is what I got to so far. When I reboot and run systemctl status mosquitto.service
I show that mosquitto is loaded but not active:
[Unit]
Description=Mosquitto MQTT Broker
[Service]
WorkingDirectory=/usr/sbin/mosquitto
ExecStart=/etc/mosquitto/mosquitto.conf
Restart=always
[Install]
WantedBy=multi-user.target
EDIT 2:
Ran sudo systemctl enable mosquitto.service
. Now the error exit code is:
Process: 1720 ExecStart=/etc/mosquitto/mosquitto.conf (code=exited, status=200/CHDIR)
16.04 systemd
I am trying to run a Mosquitto MQTT Broker on Ubuntu 16.04. I have instructions from 14.04, but since 16.04 no longer uses startup, I can't figure out how to convert to systemd.
Here are the commands for 14.04:
description "Mosquitto MQTT broker"
start on net-device-up
respawn
exec /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
EDIT:
This is what I got to so far. When I reboot and run systemctl status mosquitto.service
I show that mosquitto is loaded but not active:
[Unit]
Description=Mosquitto MQTT Broker
[Service]
WorkingDirectory=/usr/sbin/mosquitto
ExecStart=/etc/mosquitto/mosquitto.conf
Restart=always
[Install]
WantedBy=multi-user.target
EDIT 2:
Ran sudo systemctl enable mosquitto.service
. Now the error exit code is:
Process: 1720 ExecStart=/etc/mosquitto/mosquitto.conf (code=exited, status=200/CHDIR)
16.04 systemd
16.04 systemd
edited Aug 22 '16 at 17:02
pekasus
asked Aug 21 '16 at 20:53
pekasuspekasus
38116
38116
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
Installing sudo apt install mosquitto
on 16.04
adds the /etc/init.d/mosquitto
script. systemd uses that script to generate /run/systemd/generator.late/mosquitto.service
, and this is what it says:
# Automatically generated by systemd-sysv-generator
[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/mosquitto
Description=LSB: mosquitto MQTT v3.1 message broker
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
Before=shutdown.target
After=remote-fs.target
After=systemd-journald-dev-log.socket
Conflicts=shutdown.target
[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/mosquitto start
ExecStop=/etc/init.d/mosquitto stop
ExecReload=/etc/init.d/mosquitto reload
Looking inside /etc/init.d/mosquitto
tells us that
/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
is already run by default
So just put your config into /etc/mosquitto/conf.d
(referenced by mosquitto.conf
) and enjoy.
Being a regular systemd service, you can:
systemctl status mosquitto
to see its current statussudo systemctl (start|stop) mosquitto
to change the status for the current sessionsudo systemctl (enable|disable) mosquitto
to change startup behavior (without affecting the current state)
How does that file tell you that mosquitto is being run with-c option
?
– Petrus Theron
Dec 13 '18 at 9:45
@PetrusTheron that's what happens in the/etc/init.d/mosquitto
file with thestart
argument.
– Mihail Malostanidis
Dec 13 '18 at 9:53
add a comment |
Your unit file's ExecStart=
and WorkingDirectory=
lines are completely wrong. Are you trying to start a config file, using the executable file(!) as its working directory?
If I understand correctly, the proper unit file would be:
[Unit]
Description=Mosquitto MQTT Broker
After=network.target
[Service]
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Restart=always
[Install]
WantedBy=multi-user.target
Also, please don't conflate starting and enabling the unit. Read my similar answers about this:
- start nginx on boot
- Is it expected for systemd to start disabled services?
add a comment |
Be sure that you have mosquitto running:
ps -aux | grep mosquitto
And you have this in default.conf:
listener 1883
add a comment |
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f815091%2fhow-do-i-start-mosquitto-mqtt-broker-on-startup-in-ubuntu-16-04%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Installing sudo apt install mosquitto
on 16.04
adds the /etc/init.d/mosquitto
script. systemd uses that script to generate /run/systemd/generator.late/mosquitto.service
, and this is what it says:
# Automatically generated by systemd-sysv-generator
[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/mosquitto
Description=LSB: mosquitto MQTT v3.1 message broker
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
Before=shutdown.target
After=remote-fs.target
After=systemd-journald-dev-log.socket
Conflicts=shutdown.target
[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/mosquitto start
ExecStop=/etc/init.d/mosquitto stop
ExecReload=/etc/init.d/mosquitto reload
Looking inside /etc/init.d/mosquitto
tells us that
/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
is already run by default
So just put your config into /etc/mosquitto/conf.d
(referenced by mosquitto.conf
) and enjoy.
Being a regular systemd service, you can:
systemctl status mosquitto
to see its current statussudo systemctl (start|stop) mosquitto
to change the status for the current sessionsudo systemctl (enable|disable) mosquitto
to change startup behavior (without affecting the current state)
How does that file tell you that mosquitto is being run with-c option
?
– Petrus Theron
Dec 13 '18 at 9:45
@PetrusTheron that's what happens in the/etc/init.d/mosquitto
file with thestart
argument.
– Mihail Malostanidis
Dec 13 '18 at 9:53
add a comment |
Installing sudo apt install mosquitto
on 16.04
adds the /etc/init.d/mosquitto
script. systemd uses that script to generate /run/systemd/generator.late/mosquitto.service
, and this is what it says:
# Automatically generated by systemd-sysv-generator
[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/mosquitto
Description=LSB: mosquitto MQTT v3.1 message broker
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
Before=shutdown.target
After=remote-fs.target
After=systemd-journald-dev-log.socket
Conflicts=shutdown.target
[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/mosquitto start
ExecStop=/etc/init.d/mosquitto stop
ExecReload=/etc/init.d/mosquitto reload
Looking inside /etc/init.d/mosquitto
tells us that
/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
is already run by default
So just put your config into /etc/mosquitto/conf.d
(referenced by mosquitto.conf
) and enjoy.
Being a regular systemd service, you can:
systemctl status mosquitto
to see its current statussudo systemctl (start|stop) mosquitto
to change the status for the current sessionsudo systemctl (enable|disable) mosquitto
to change startup behavior (without affecting the current state)
How does that file tell you that mosquitto is being run with-c option
?
– Petrus Theron
Dec 13 '18 at 9:45
@PetrusTheron that's what happens in the/etc/init.d/mosquitto
file with thestart
argument.
– Mihail Malostanidis
Dec 13 '18 at 9:53
add a comment |
Installing sudo apt install mosquitto
on 16.04
adds the /etc/init.d/mosquitto
script. systemd uses that script to generate /run/systemd/generator.late/mosquitto.service
, and this is what it says:
# Automatically generated by systemd-sysv-generator
[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/mosquitto
Description=LSB: mosquitto MQTT v3.1 message broker
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
Before=shutdown.target
After=remote-fs.target
After=systemd-journald-dev-log.socket
Conflicts=shutdown.target
[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/mosquitto start
ExecStop=/etc/init.d/mosquitto stop
ExecReload=/etc/init.d/mosquitto reload
Looking inside /etc/init.d/mosquitto
tells us that
/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
is already run by default
So just put your config into /etc/mosquitto/conf.d
(referenced by mosquitto.conf
) and enjoy.
Being a regular systemd service, you can:
systemctl status mosquitto
to see its current statussudo systemctl (start|stop) mosquitto
to change the status for the current sessionsudo systemctl (enable|disable) mosquitto
to change startup behavior (without affecting the current state)
Installing sudo apt install mosquitto
on 16.04
adds the /etc/init.d/mosquitto
script. systemd uses that script to generate /run/systemd/generator.late/mosquitto.service
, and this is what it says:
# Automatically generated by systemd-sysv-generator
[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/mosquitto
Description=LSB: mosquitto MQTT v3.1 message broker
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
Before=shutdown.target
After=remote-fs.target
After=systemd-journald-dev-log.socket
Conflicts=shutdown.target
[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/mosquitto start
ExecStop=/etc/init.d/mosquitto stop
ExecReload=/etc/init.d/mosquitto reload
Looking inside /etc/init.d/mosquitto
tells us that
/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
is already run by default
So just put your config into /etc/mosquitto/conf.d
(referenced by mosquitto.conf
) and enjoy.
Being a regular systemd service, you can:
systemctl status mosquitto
to see its current statussudo systemctl (start|stop) mosquitto
to change the status for the current sessionsudo systemctl (enable|disable) mosquitto
to change startup behavior (without affecting the current state)
edited Mar 6 at 12:39
answered Mar 8 '17 at 12:58
Mihail MalostanidisMihail Malostanidis
24639
24639
How does that file tell you that mosquitto is being run with-c option
?
– Petrus Theron
Dec 13 '18 at 9:45
@PetrusTheron that's what happens in the/etc/init.d/mosquitto
file with thestart
argument.
– Mihail Malostanidis
Dec 13 '18 at 9:53
add a comment |
How does that file tell you that mosquitto is being run with-c option
?
– Petrus Theron
Dec 13 '18 at 9:45
@PetrusTheron that's what happens in the/etc/init.d/mosquitto
file with thestart
argument.
– Mihail Malostanidis
Dec 13 '18 at 9:53
How does that file tell you that mosquitto is being run with
-c option
?– Petrus Theron
Dec 13 '18 at 9:45
How does that file tell you that mosquitto is being run with
-c option
?– Petrus Theron
Dec 13 '18 at 9:45
@PetrusTheron that's what happens in the
/etc/init.d/mosquitto
file with the start
argument.– Mihail Malostanidis
Dec 13 '18 at 9:53
@PetrusTheron that's what happens in the
/etc/init.d/mosquitto
file with the start
argument.– Mihail Malostanidis
Dec 13 '18 at 9:53
add a comment |
Your unit file's ExecStart=
and WorkingDirectory=
lines are completely wrong. Are you trying to start a config file, using the executable file(!) as its working directory?
If I understand correctly, the proper unit file would be:
[Unit]
Description=Mosquitto MQTT Broker
After=network.target
[Service]
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Restart=always
[Install]
WantedBy=multi-user.target
Also, please don't conflate starting and enabling the unit. Read my similar answers about this:
- start nginx on boot
- Is it expected for systemd to start disabled services?
add a comment |
Your unit file's ExecStart=
and WorkingDirectory=
lines are completely wrong. Are you trying to start a config file, using the executable file(!) as its working directory?
If I understand correctly, the proper unit file would be:
[Unit]
Description=Mosquitto MQTT Broker
After=network.target
[Service]
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Restart=always
[Install]
WantedBy=multi-user.target
Also, please don't conflate starting and enabling the unit. Read my similar answers about this:
- start nginx on boot
- Is it expected for systemd to start disabled services?
add a comment |
Your unit file's ExecStart=
and WorkingDirectory=
lines are completely wrong. Are you trying to start a config file, using the executable file(!) as its working directory?
If I understand correctly, the proper unit file would be:
[Unit]
Description=Mosquitto MQTT Broker
After=network.target
[Service]
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Restart=always
[Install]
WantedBy=multi-user.target
Also, please don't conflate starting and enabling the unit. Read my similar answers about this:
- start nginx on boot
- Is it expected for systemd to start disabled services?
Your unit file's ExecStart=
and WorkingDirectory=
lines are completely wrong. Are you trying to start a config file, using the executable file(!) as its working directory?
If I understand correctly, the proper unit file would be:
[Unit]
Description=Mosquitto MQTT Broker
After=network.target
[Service]
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Restart=always
[Install]
WantedBy=multi-user.target
Also, please don't conflate starting and enabling the unit. Read my similar answers about this:
- start nginx on boot
- Is it expected for systemd to start disabled services?
edited May 23 '17 at 12:39
Community♦
1
1
answered Aug 23 '16 at 20:05
intelfxintelfx
32018
32018
add a comment |
add a comment |
Be sure that you have mosquitto running:
ps -aux | grep mosquitto
And you have this in default.conf:
listener 1883
add a comment |
Be sure that you have mosquitto running:
ps -aux | grep mosquitto
And you have this in default.conf:
listener 1883
add a comment |
Be sure that you have mosquitto running:
ps -aux | grep mosquitto
And you have this in default.conf:
listener 1883
Be sure that you have mosquitto running:
ps -aux | grep mosquitto
And you have this in default.conf:
listener 1883
answered 12 mins ago
İsmail Yavuzİsmail Yavuz
11118
11118
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f815091%2fhow-do-i-start-mosquitto-mqtt-broker-on-startup-in-ubuntu-16-04%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown