#!/bin/bash
while true
do
num=`ss -tl | grep -c mysql`
if [ $num -eq 0 ];then
echo "赶快重启mysql的服务" | mail -s "mysql已经关闭" xxxxxx@qq.com
break
fi
done
备注
- xxxxxx@qq.com是推送的接收的邮箱
- 有安装mail的服务
#!/bin/bash
while true
do
num=`ss -tl | grep -c mysql`
if [ $num -eq 0 ];then
echo "赶快重启mysql的服务" | mail -s "mysql已经关闭" xxxxxx@qq.com
break
fi
done
备注