#!/bin/bash a=`curl -o /dev/null -s -w %{http_code} "http://www.baidu.com"` if [ $a -eq 200 ] then echo ok else echo down| mail -s "mongod down" 825536458@qq.com fi