[weblogic@app59 ~]$ crontab -l
30 * * * * /home/weblogic/check_http.sh >>/home/weblogic/check_http.log 2>&1
[weblogic@zj-zkrapp59 ~]$ cat check_http.sh
#!/bin/bash
url=http://192.168.3.44:8001/index.jsp
domain_home=/weblogic/bea/user_projects/domains/test01dm
check_http(){
status_code=$(curl -m 5 -s -o /dev/null -w %{http_code} $url)
}
check_http
#dt=`date "+%F %T"`
echo `date "+%F %T"` " status_code=$status_code"
if [ $status_code -ne 200 ];then
WEBLOGIC_PID=`ps -ef|grep weblogic |grep java|grep -v grep |awk '{print $2}'`
if [ $WEBLOGIC_PID -ne 0 ]; then
kill -9 $WEBLOGIC_PID
# echo $WEBLOGIC_PID
fi
cd $domain_home
. ~/.bash_profile
nohup ./startWebLogic.sh &
echo `date "+%F %T"` " Restart domain"
fi