当前位置: 首页 > news >正文

shell 脚本发布前后端代码

shell 脚本发布前后端代码

  • 1、发布前端
  • 2、发布后端

1、发布前端

#! /bin/bashif [ ! $1 ]
thenecho "this command needs 1 parameters"exit
fiif [ -d "/usr/local/nginx/html/xxxx-$1" ]
thenecho "file exists: /usr/local/nginx/html/xxxx-$1, please check input parameters"exit
fiif [ ! -f "~/xxxx.zip" ]
thenecho "file not exists: ~/xxxx.zip"exit
fiecho "start version updating..."echo "starting back old web static files..."
mv xxxx xxxx-back-$1echo "unzip new web static files..."
unzip ~/xxxx.zip -d /usr/local/nginx/htmlecho "version update finished!"

2、发布后端

#! /bin/bashif [ ! $1 ]
thenecho "this command needs 1 parameters"exit
fiif [ -f "/home/apache-tomcat-8.5.84/webapps/xxxx.war.$1back" ]
thenecho "file exists: /home/apache-tomcat-8.5.84/webapps/xxxx.war.$1back, please check input parameters"exit
fiif [ ! -f "~/xxxx.war" ]
thenecho "file not exists: ~/xxxx.war"exit
fiecho "start version updating..."echo "shutting down Tomcat server..."
/home/apache-tomcat-8.5.84/bin/shutdown.sh
sleep 15s
netstat -nptl
echo "Tomcat server shut down."echo "starting back war..."
mv /home/apache-tomcat-8.5.84/webapps/xxxx.war /home/apache-tomcat-8.5.84/webapps/xxxx.war.$1backecho "deleting old webApp file archive..."
rm -rf /home/apache-tomcat-8.5.84/webapps/xxxxecho "copying new version webApp to Tomcat server..."
cp ~/xxxx.war /home/apache-tomcat-8.5.84/webappsecho "restarting Tomcat server..."
/home/apache-tomcat-8.5.84/bin/startup.shsleep 15s
netstat -nptlecho "version update finished!"

参考: Shell脚本编程30分钟入门

http://www.lryc.cn/news/158083.html

相关文章:

  • 我的私人笔记(Linux中安装mysql)
  • IDEA版SSM入门到实战(Maven+MyBatis+Spring+SpringMVC) -Maven目录结构和idea的整合
  • Android Automotive概述
  • iOS 16.4更新指南:问题解答与新功能一览
  • Vue + Element UI 前端篇(八):管理应用状态
  • 开发常用代码区
  • SpringBoot+MySQL+Vue前后端分离的宠物领养救助管理系统(附论文)
  • ClickHouse 存算分离改造:小红书自研云原生数据仓库实践
  • STM32-DMA
  • 1065 A+B and C (64bit)
  • 阿里云效和阿里在线idea使用
  • [git] 删除分支中的内容 -> 空分支
  • git 配置
  • vue router进行路由跳转并携带参数(params/query)
  • Mysql触发器
  • 认识doubbo和rpc
  • get_views中list的arch格式
  • 淘宝商品销量接口API更新(总销+精准月销API)
  • Android 11编译第三弹 ADB开启ROOT权限
  • 《TCP/IP网络编程》--基于TCP实现字符串对话和文件传输
  • Feign负载均衡写法
  • OpenCV(二十八):连通域分割
  • 达梦控制台还原报错“管道失败”
  • [杂谈]-快速了解直接内存访问 (DMA)
  • java八股文面试[设计模式]——23种设计模式
  • mysql(十)mysql主从复制--主库切换
  • vue3项目的src下的各个文件夹介绍
  • 五、编译预处理
  • 应用出海,Google 分享如何让数字营销素材再上层楼
  • 酱香咖啡喝了没?用数据分析揭秘瑞幸咖啡的7500万用户增长策略