#!/bin/bash
while :
do
status=`curl -s --head http://www.1paituan.com/index.jsp | awk '/HTTP/ {print $2}'`
if [ "$status" == "200" ]
then
:
else
echo "1paituan.com is critical" | mail -s "1paituan.com is critical.please check " 1309889xxxx@wo.com.cn
fi
sleep 5
done
#crontab time 00:10
#!/bin/bash
#check MySQL_Slave Status
#crontab time 00:10
MYSQLPORT=`netstat -na|grep "LISTEN"|grep "3306"|awk -F[:" "]+ '{print $4}'`
MYSQLIP=`ifconfig eth0|grep "inet addr" | awk -F[:" "]+ '{print $4}'`
IO_env=`echo $STATUS | grep IO | awk ' {print $2}'`
SQL_env=`echo $STATUS | grep SQL | awk '{print $2}'`
DATA=`date +"%y-%m-%d %H:%M:%S"`
if [ "$MYSQLPORT" == "3306" ]
then
echo "mysql is running"
else
echo $MYSQLIP mysql is down" | mail -s "warn!server: $MYSQLIP mysql is down" 1309889xxxx@wo.com.cn
fi
if [ "$IO_env" = "Yes" -a "$SQL_env" = "Yes" ]
then
echo "Slave is running!"
else
echo "Slave is not running!" | mail -s "warn! $DATA $MYSQLIP MySQL Slave is not running" 1309889xxxx@wo.com.cn
fi