Start and stop mosquitto server from node-red

Hello everybody,
I would like to start and stop mosquitto server from node-red and not from the windows command i Windows 10 OS.
I have used the "exec" node with the command "net start mosquitto" but error 5 occured because I think node-red doesn't start mosquitto with administrator permissons.
I there a way to start en stop Mosquitto server from node-red?
Thank you for your help.

Welcome to the forum @jim53

I don't know how to solve your problem, but I would be interested to know why you need to do that. It seems a strange thing to want to do.

Hello Colin,
I want to do that because I don't want to manage the mosquittto server outside the node-red flow.
For me, it seems to be better to not have to start the mosquitto server before starting the node-red flow.

In that case you could just use an exec node to call it, rather than try to start it as a service.

Dear dceejay,

I have tried already to use the exec node but I have the system error 5 after the flow launches the command
To start the Mosquitto server, I need to have administrator privileges but I d'ont know how to change my command "net start mosquitto" to specify to run it with administrator privileges.

Why use net start mosquitto. ? Can’t you just run mosquitto?

What advantage do you see from doing that?

But if you do want to then Dave's suggestion should do it. Don't try and start the service, just exec mosquitto.

[Edit] You might need a command line parameter to tell it where to load its config from.

That is hard to believe. Mosquitto server is a separat application without any dependencies or need of node-red

1 Like