1绷柒、mysql
!/bin/sh
port=netstat -lnt|grep 3306|wc -l
if [ $port -ne 1 ];then
echo "mysql is stop"
/etc/init.d/mysqld start
else
echo "mysql is starting"
fi
2、監(jiān)控Nginx
!/bin/sh
port=netstat -lnt|grep 80|wc -l
if [ $port -ne 1 ];then
echo "nginx is stop"
/usr/sbin/nginx
else
echo "nginx is starting"
fi