Jenkins 发布 web 应用至 Tomcat(shell 方式)
Posted 江湖小小白
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Jenkins 发布 web 应用至 Tomcat(shell 方式)相关的知识,希望对你有一定的参考价值。
后台
/opt/tomcat-9.0.35/bin/shutdown.sh count=`jps | grep spis | wc -l` if [ $count -gt 0 ]; then jps | grep spis | awk \'{print $1}\' | xargs kill -9 fi count=`lsof -i:80 | awk \'NR>=2\' | awk \'{print $2}\' | wc -l` if [ $count -gt 0 ]; then lsof -i:80 | awk \'NR>=2\' | awk \'{print $2}\' | xargs kill -9 else echo $count fi cd /opt/spis/ rm -rf nohup.out spis.jar cp /opt/jenkins/workspace/spis-springboot/spis-server/target/spis.jar /opt/spis/spis.jar export BUILD_ID=dontKillMe nohup java -Xms4096m -Xmx4096m -Xmn1024m -jar /opt/spis/spis.jar &
前端
需要 https://plugins.jenkins.io/nodejs/ 插件
npm run clean:dist npm run ng build --prod --aot=false --build-optimizer=false --optimization --progress --extractCss count=`lsof -i:8080 | awk \'NR>=2\' | awk \'{print $2}\' | wc -l` if [ $count -gt 0 ]; then lsof -i:8080 | awk \'NR>=2\' | awk \'{print $2}\' | xargs kill -9 else echo $count fi rm -rf /opt/spis/app mv ./dist /opt/spis/app/ cd /opt/nginx-1.18.0/ rm -rf nohup.out export BUILD_ID=dontKillMe nohup ./sbin/nginx &
以上是关于Jenkins 发布 web 应用至 Tomcat(shell 方式)的主要内容,如果未能解决你的问题,请参考以下文章