How to control a web server using daemontools?

How should I daemontools dispatcher script?

I started using daemontools by D.J. Bernstein to support some processes and work fine. But now I need to track a few additional conditions for these processes, and I could not find good information on how to do this.

My scenario is that I have some processes running for a web application (pharo smalltalk virtual machines) and they respond to http, each in its own port (for balancing). I would like to test them somehow to make sure that they not only work, but also respond to HTTP requests. If they do not respond in a certain way to the request for more than 30 seconds, they should be considered as broken and simply restarted.

Is this possible with daemontools? if so, how can I write this script and where to place it? or where is the documentation about this?

+5
source share
2 answers

The simplest solution is to create another daemontool task using a script that sleeps for 30 seconds and then checks for the existence of a service (for example, using wget or curl). If the service does not respond in a timely manner, you can restart the service ( svc -t yourapp) and / or send a notification. The run-script of a new service might look so simple:

#!/bin/sh
sleep 30
if ! wget --quiet --timeout=5 --delete-after "http://yourapp.com/" ; then
  svc -t /etc/service/yourapp
fi

, Munin. script, . REST, , , , gc, , ... , - .

+6

, , ( HTTP /)

curl --connect-timeout 10 http://8.8.8.8 
curl: (28) connect() timed out!

, , , 200 (OK) ..

+3

All Articles