while true; do server=`ps -aux | grep tomcat | grep -v grep` if [ ! "$server" ]; then echo "Tomcat挂了" | mail -s "Tomcat" xxxx@qq.com break fi sleep 5 done
while true; do server=`ps -aux | grep tomcat | grep -v grep` if [ ! "$server" ]; then echo "Tomcat挂了" | mail -s "Tomcat" xxxx@qq.com break fi sleep 5 done