#!/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

相关文章:

  • 2022-02-13
  • 2022-12-23
  • 2022-02-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-19
  • 2021-11-03
  • 2021-06-12
  • 2022-12-23
  • 2021-07-03
  • 2021-07-15
相关资源
相似解决方案