I am trying to learn the best practices for checking that Apache and Postgres are running on my server. If either of them have stopped, I want to auto-restart these services. I'm using Ubuntu 12.04 LTS.
My strategy, was to write a cron job that checked that both of these services were alive every 5 minutes, and if they are not, to restart them (and to email me that there was a problem).
I'm unsure if there is a better way to do this. I currently use Fabric to administer the server remotely; and was also wondering if trying to write this all in Python could be an appropriate approach.