首页 > 代码库 > 脚本检测URL
脚本检测URL
[root@gxapp01 shells]# cat check_saqz.sh
#!/bin/bash
#date=2014-09-06
#is to check the http status.if it is not OK ,restart the progress
restart_saqz ()
{
kill -9 `ps -elf | grep jboss-saqz |grep -v "grep jboss-saqz" | awk -F‘ ‘ ‘{print $4}‘ |tail -1`
rm -rf /usr/local/jboss/server/jboss-saqz/tmp/*
rm -rf /usr/local/jboss/server/jboss-saqz/work/*
chown -R jboss:jboss /usr/local/jboss/server/jboss-saqz/
/usr/local/jboss/bin/start-saqz.sh &
}
CODE=`curl -o /dev/null -s -m 10 --connect-timeout 10 -w %{http_code} http://IP:8280`
if [ $CODE -eq 200 ];then
echo "`date +"%Y%m%d %H:%M"`the server is up">>/dev/null
else
echo "`date +"%Y%m%d %H:%M"` the server is DOWN" >>/tmp/down.log
restart_saqz
echo -e "`date +"%Y-%m-%d %H:%M"` \n app restart ok" | mail -s " IP restart ok" 139.com邮箱 ,qq邮箱.com
fi
本文出自 “路由汗水交换成功” 博客,请务必保留此出处http://ghnhl.blog.51cto.com/1630025/1553285
脚本检测URL