美文网首页
shell 脚本项目拉取

shell 脚本项目拉取

作者: 唐岭云 | 来源:发表于2018-03-12 17:16 被阅读9次
    vim depoly.sh
    
    #!/bin/bash
    echo "----------------------------------"  
    echo "请选择需要部署的项目:"  
    echo "(0) 项目1"  
    echo "(1) 项目2"  
    echo "(2) 项目3"  
    echo "(3) 退出"  
    echo "----------------------------------"  
    read -t 30 -p "请输入项目编号:" input
    case $input in
        0)
             projectName="项目1";;
        1)
         projectName="项目2";;  
        2) 
             projectName="项目3";;   
        3)
             exit;;
    esac
    pid_no=$(ps -ef | grep ${projectName} | grep -v grep | awk '{print $2}');
    if [ -n "$pid_no" ];then
     echo "杀死${projectName}进程的编号:${pid_no}"
     kill -9 "$pid_no"
     sleep 2
    else
     echo "当前${projectName}项目已经被关闭"
    fi
    cd /opt/source_code
    read -t 30 -p  "请输入当前${projectName}项目分支svn地址:" svn_path
    if [ -n "$svn_path" ];then
     echo "移除${projectName}项目源码"
     rm -rf $projectName
     echo "拉取${projectName}分支项目"
     sleep 3
     svn co ${svn_path} ${projectName}
    else
     echo "项目svn路径不能为空";exit;
    fi
    cd ${projectName}
    mvn clean
    nohup mvn tomcat7:run -Dspring.profiles.active=lml >/dev/null 2>&1 &
    tail -f /var/log/webapps/${projectName}/${projectName}-info.log
    
    
    chmod +x depoly.sh
    

    相关文章

      网友评论

          本文标题:shell 脚本项目拉取

          本文链接:https://www.haomeiwen.com/subject/omfofftx.html