toxic

备忘录

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
#!/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
posted on 2012-10-17 16:39  toxic  阅读(273)  评论(0编辑  收藏  举报