weblogic自动重启服务的脚本

#!/bin/bash
# kill the process and clean the cache and start the weblogic
# author by : guoqian
# date : 2018-04-27

cd /home/weblogic/Oracle/Middleware/user_projects/domains/list_domain/bin
if [ $# -eq 0 ]; then
        netstat -antulp|grep LISTEN |grep '7002' |awk '{print $7}'|awk -F '/' '{print $1}'|sort |uniq|xargs kill -9
        if [ $? -eq 0 ]; then
                echo "The process has been killed"
        else
                echo "The process not been killed"
                exit 1
        fi
        echo "**************************************************************"
        sleep 5
        cd /home/weblogic/Oracle/Middleware/user_projects/domains/list_domain/servers/AdminServer/tmp
        /bin/rm -rf _WL_user
        if [ $? -eq 0 ]; then
                echo "The programme cache has been cleaned"
        else
                echo "The programme cache not been cleaned"
                exit 2
        fi
        echo "***************************************************************"
        sleep 5
        cd /home/weblogic/Oracle/Middleware/user_projects/domains/list_domain/bin
        nohup ./startWebLogic.sh >>/home/weblogic/Oracle/Middleware/user_projects/domains/list_domain/bin/nohup.out  &
        if [ $? -eq 0 ];then
                echo "The weblogic start success"
                tail -f nohup.out
                exit 0
        else
                echo "The weblogic start failed"
                exit 3
        fi
else
        echo "Usage:./kill_cleancache_start.sh"
fi

1.此脚本自动杀7002端口下的进程,清除缓存,自动重启服务。

2.此脚本在Red Hat Enterprise Linux Server release 5.6 (Tikanga)下通过测试。

3.24小时绿色联系通道:QQ:418892106    E-mail:[email protected]

猜你喜欢

转载自www.cnblogs.com/guoqian/p/9203463.html