Restart dead daemon automatically

This is a simple bash script to restart a dead daemon, in this example I’ll use apache

#!/bin/bash

# Automatically restart httpd if it dies
netstat -ln | grep ":80 " | wc -l | awk '{if ($1 == 0) system("/etc/init.d/httpd restart") }'