• 免得每次都杀进程


    1.启动脚本时总是要使用 ps -ef | grep "服务名称" 比较烦 后面写了脚本:

    LANG=zh_CN.GBK export LANG
    #ps -ef|grep ServerName | grep -v grep |awk '{print $2}' | xargs kill -9
    Process=`ps -ef|grep ServerName|grep -v grep|awk '{print $2}'`
    #echo $p1
    if [ -z $Process ]; then
    #echo -e "33[37;31;5m
    #****************************************************
    #*                                                   *
    #*                                                   *
    #*    ServerNameProcess number does not exist !   *
    #*                                                   *
    #*                                                   *
    #****************************************************
    #033[39;49;0m"
    
    echo -e "e[1;31m
    ****************************************************
    *                                                   *
    *                                                   *
    *   >>>>>> ServerName 进程号不存在 !<<<<<<<<<     *
    *                                                   *
    *                                                   *
    ****************************************************
    e[0m"
    else
    ps -ef|grep ServerName| grep -v grep |awk '{print $2}' | xargs kill -9 
    fi 
    rm -rf /weblogic/domains/ServerName/servers/ServerName/tmp/
    #判断有木有可解压缩的文件 *.tar 
    if [ -e /weblogic/domains/ServerName/*.tar ];then
      tar -xf /weblogic/domains/ServerName/*.tar ;
        sleep 3;
        echo -e "e[1;31m------------>>> *.tar 解压缩完毕 !<<<<<-----------------e[0m ";
          cp -b /weblogic/domains/ServerName/config/applicationContext.xml /weblogic/domains/ServerName;
       echo -e "e[1;31m---------->>>> applicationContext.xml 文件拷贝成功!<<<<<<--------------e[0m";
         rm /weblogic/domains/*.tar ;
       echo -e "e[1;31m--------->>>>> *.tar 删除成功!<<<<<<<------------ e[0m";
    else
        echo -e  "
    
    33[1;37;31;5m--->>>>>  指定解压缩的tar包不存在 !<<<<<-------- 33[39;49;0m"
    fi    
    #sleep 2
    echo  " 
                          _
                         | |
                         | |
                        _| |_
                            /
                           /
                         \_/  
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    >>>                               >>> 
    >>>      开始启动ServerName服务!             >>>
    >>>                                            >>>
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                             
    "
    cd /weblogic/domains/ServerName/
    nohup sh startWebLogic.sh &
    sleep 1;
    tail -f /weblogic/domains/ServerName/nohup.out;
  • 相关阅读:
    Spring中的Bean相关问题
    请谈一下spring bean的生命周期
    请谈一谈IOC中的继承和Java中的继承有什么区别
    谈谈你对Spring IOC和DI的理解,以及它们的区别
    Spring中用到了哪些设计模式
    JAVA自学笔记11
    JAVA自学笔记14
    JAVA自学笔记12
    JAVA自学笔记15
    JAVA自学笔记18
  • 原文地址:https://www.cnblogs.com/linbo3168/p/8855662.html
Copyright © 2020-2023  润新知