bashでhealth checkのめも
php-fpmとcrondを監視します
#!/bin/bash
while true
do
PHP=`sudo ps ax | grep 'php-fpm: master' | grep -v grep | wc -l`
CROND=`sudo ps ax | grep 'crond' | grep -v grep | wc -l`
if [ $PHP = 1 ] && [ $CROND = 1 ] ; then
echo "HTTP/1.0 200 Ok" | nc -l 8080
else
echo "HTTP/1.0 500 NG" | nc -l 8080
fi
[ $? != 0 ] && break
done