When running GeoServer in a production environment, the last thing we want to happen is for an instance to fail, and the first time we hear about it is when a customer complains. In this scenario, what we need is a script that can be executed on a schedule to check that GeoServer is still up and responding to requests.
These types of scripts are commonly referred to as Watchdog scripts. The principle behind the script is very simple: it makes a request to the server, and if it receives a failed response, then it attempts to restart the service.
When running GeoServer in a production environment, we need to create a Watchdog script that executes on a regular schedule and performs the following checks:
Checks that the Tomcat service is up:
If not up, it attempts to restart the service
If the service cannot be restarted, an administrator is e-mailed
If Tomcat is running, then a test request is made to GeoServer:
If a 200 response is not received, the service...