Keep Mongoose running 24/7

How to Keep the Mongoose Windows Service Running 24/7 with Service Protector

Automatically restart Mongoose when it crashes or stops for any reason. Ensure that your files are available from your web browser at all times!

Mongoose is a lightweight yet feature-rich web server produced by Cesanta Software. It can be installed as a Windows Service to start immediately at boot and run entirely unattended in the background:

Here's what it looks like in the Services control panel application:


To monitor & protect Mongoose with Service Protector:

  1. Install and configure Mongoose, if necessary. We already have Mongoose Free Edition installed as a windows service on our Windows Server 2012 R2 PC.

  2. Download and install Service Protector, if necessary.

  3. Start Service Protector.

  4. Select Protector > Add to open the Add Protector window:

    Add Protector

  5. On the General tab, in the Service to protect field, select the Mongoose windows service.

    You will notice a green circle on the left if the service is already running, as pictured below.

    Mongoose Windows Service: General Tab

  6. Click over to the Monitor tab, where we will set up a failure detection script to tell Service Protector when Mongoose has failed and is not serving pages.

    1. Follow these instructions to create the failure detection BAT file. We have called ours check-web-server.bat and placed it in our Mongoose folder (C:\Mongoose).

    2. Click the "..." button in the Whenever it fails a "sanity check" section and specify the full path to the batch file.

    3. Specify how often to check the web server. Every 15 minutes is fine for us...

    Mongoose Windows Service: Monitor Tab

  7. We're done configuring Mongoose with Service Protector so click the Save button to record your settings. In a second or two, an entry for Mongoose will show up in the Service Protector window. Here the Mongoose service is already running but it's not yet being monitored by Service Protector (hence the red shield).

    Mongoose Windows Service: Created

  8. To start protection, choose Protector > Start "Mongoose". The shield icon will go to green to indicate that the Mongoose service is being watched by Service Protector:

    Mongoose Windows Service: Protected

  9. That's it! Next time your computer boots, Mongoose will start (as normal) and Service Protector will begin watching the service to promptly restart it if it stops for any reason.

    We encourage you to edit the Mongoose entry in Service Protector and check out the many other settings that may be appropriate for your environment. For example, send email alerts when the service fails, restart the service if it gets stuck starting or stopping, and much more.



Trouble protecting the Mongoose Windows Service?