-
Download and install Mosquitto, if necessary.
Be sure to select the service component when installing:
-
Download and
install
Service Protector, if necessary.
-
Start Service Protector.
-
Select Protector > Add to open the Add Protector window:
-
On the General tab, in the Service to protect field, choose Mosquitto Broker.
You will notice a green circle on the left if Mosquitto is already running, as was the case on our server:
-
Switch to the Monitor tab. Let's set up a nightly restart of the broker, to keep Mosquitto fresh and free of debilitating resource leaks.
Check the At the following times box, click the Add button, and specify a "quiet" time to restart the service.
Sunday mornings at 1 AM works for us:
-
And if you find that the Mosquitto service takes a while to shut down, switch to the Extras tab and
increase the wait time from 1 to 2 minutes:
-
Click the Save button. In a few seconds, an entry for Mosquitto will show up in the Service Protector window.
The service is already being protected from failure, as evidenced by the green shield:
-
That's it! Next time your computer boots, Mosquitto will start automatically and Service Protector will watch the service to quickly restart it if it stops for any reason.
We encourage you to edit Mosquitto Broker in Service Protector and check out the many other settings that may be appropriate for your environment.
For example, send an email when the service fails, run a batch file to clean up before restarting the service, and much more.