#!/bin/bash service nginx status if [ $? -ne 0 ];then echo "nginx is down.try to restart now ! `date`" >> /check/check-log service nginx start #echo "nginx restart success `date`" else echo "nginx is running well! `date`" >> /check/check-log fi echo "--------------------------------------" ps -el | grep mysqld if [ $? -ne 0 ];then echo "mysql is down.try to restart now ! `date`" >> /check/check-log service mysql start #echo "mysql restart success `date`" else echo "mysql is running well `date`" >> /check/check-log fi echo "--------------------------------------" service php5-fpm status if [ $? -ne 0 ];then echo "php is down.try to restart now ! `date`" >> /check/check-log service php5-fpm start #echo "php restart success `date`" else echo "php is running well `date`" >> /check/check-log fi