【Tomcat】shell 部署配置 war包
使用shell 一次执行,将项目中的war包的配置全部修改
#!/bin/bash #----------------------------------------------- # FileName: deployWAR.sh # Reversion: 1.5 # Date: // # Author: zhengwenqiang # Email: zhengwenqiang@bonc.com.cn # Description: change the properties of the essential configuration file, it means that before you startup tomcat to run those three apps etc cas,portal,security # it's vital to run this script which bring the proccess running normally. # Notes: If you are going execute this script on linux, you should run the command "sed -i 's/\r//g' getwar.sh" # to delete invalid character which cause character error. # Changes: solve the error caused by default-schema configuration. # Copyright: (c) zhengwenqiang # License: GPL #----------------------------------------------- #cd `)` # configure Cas conf='conf.properties' ] ; then conf=$ fi if [ -f $conf ] ; then #cat -A conf.properties | grep -E -v '^\^?M' | sed 's/\^M\$$//g'>conf.sh #cat conf.properties | grep -E -v '^\^?M' | tr -d '\r' | tee conf.sh [ -f conf.sh ] && rm -f conf.sh cat $conf | grep -E -v '^\^?M' | tr -d '\r'>conf.sh chmod u+x,u+w conf.sh sed -i '1i \#\!\/bin\/bash' conf.sh && chmod u-w conf.sh source conf.sh else echo "conf.properties not found">install.log exit ; fi if [ -z $cas_ip ] ; then # cas_ip=`ip addr | tr -d 'inet '` cas_ip=`ip addr show | | sed 's/[^0-9\.]//g'` fi if [ -z $security_ip ] ; then security_ip=$cas_ip fi if [ -z $portal_ip ] ; then portal_ip=$security_ip fi cd webapps if [ $casEnable == "true" ] ; then [ -d cas ] && rm -rf cas cas_war=`` if [ -f ${cas_war} ] ; then mkdir cas && unzip ${cas_war} -d cas cas_pros='cas/WEB-INF/cas.properties' sed -i "s/CAS_IP:CAS_PORT/${cas_ip}:${cas_port}/g" ${cas_pros} sed -i "s/PORTAL_IP:PORTAL_PORT/${portal_ip}:${portal_port}/g" ${cas_pros} sed -i "s/SE_IP:SE_PORT/${security_ip}:${security_port}/g" ${cas_pros} cas/WEB-INF/classes/bonc-security-base.properties sed -r "s/DB_IP:DB_PORT([/:])DB_NAME/${db_ip}:${db_port}\1${db_name}/g" -i ${cas_pros} case $db_type in "mysql") sed -r '/MySQLDialect\r?$/s/^#//g' -i ${cas_pros} sed -r '/com.bonc.jdbc.MysqlDriver$/,+3s/^#//g' -i ${cas_pros} sed -r '/com.mysql.jdbc.Driver$/,+3s/^#//g' -i ${cas_pros} ;; "oracle") sed -r '/Oracle10gDialect\r?$/s/^#//g' -i ${cas_pros} sed -r '/com.bonc.jdbc.OracleDriver$/,+4s/^#//g' -i ${cas_pros} sed -r '/oracle.jdbc.driver.OracleDriver$/,+4s/^#//g' -i ${cas_pros} ;; *) ;; esac sed -i "s/DB_USERNAME/${db_username}/g" ${cas_pros} sed -i "s/DB_PASSWD/${db_passwd}/g" ${cas_pros} unset ${cas_pros} fi [ ${cas_war} != "cas.war" ] && mv ${cas_war} cas.war fi if [ $portalEnable == "true" ] ; then # Configure Portal [ -d portal ] && rm -rf portal portal_war=`` if [ -f ${portal_war} ] ; then mkdir portal && unzip ${portal_war} -d portal for portal in 'portal/WEB-INF/web.xml' 'portal/WEB-INF/classes/bonc-security-base.properties' 'portal/WEB-INF/classes/cfg.db.deploy.properties' do sed -i "s/CAS_IP:CAS_PORT/${cas_ip}:${cas_port}/g" $portal sed -i "s/PORTAL_IP:PORTAL_PORT/${portal_ip}:${portal_port}/g" $portal sed -i "s/SE_IP:SE_PORT/${security_ip}:${security_port}/g" $portal sed -r "s/DB_IP:DB_PORT([/:])DB_NAME/${db_ip}:${db_port}\1${db_name}/g" -i $portal sed -i "s/DB_USERNAME/${db_username}/g" $portal sed -i "s/DB_PASSWD/${db_passwd}/g" $portal done case $db_type in "mysql") sed -r '/^#?database.type=mysql$/,+4s/^#//g' -i 'portal/WEB-INF/classes/cfg.db.deploy.properties' sed -r '/MySQL5Dialect$/s/^#//g' -i 'portal/WEB-INF/classes/cfg.db.deploy.properties' sed -i "s/DB_SCHEMA/${db_name}/g" 'portal/WEB-INF/classes/cfg.db.deploy.properties' ;; "oracle") sed -r '/^#?database.type=oracle$/,+5s/^#//g' -i 'portal/WEB-INF/classes/cfg.db.deploy.properties' sed -r '/Oracle10gDialect$/s/^#//g' -i 'portal/WEB-INF/classes/cfg.db.deploy.properties' sed -i "s/DB_SCHEMA/${db_username}/g" 'portal/WEB-INF/classes/cfg.db.deploy.properties' ;; *) ;; esac fi fi # Configure Security if [ $securityEnable == "true" ] ; then [ -d security ] && rm -rf security security_war=`` if [ -f ${security_war} ] ; then mkdir security && unzip ${security_war} -d security for security in 'security/WEB-INF/web.xml' 'security/WEB-INF/classes/bonc-security-base.properties' 'security/WEB-INF/classes/cfg.db.deploy.properties' 'security/WEB-INF/classes/bonc-security.properties' do sed -i "s/CAS_IP:CAS_PORT/${cas_ip}:${cas_port}/g" $security sed -i "s/SE_IP:SE_PORT/${security_ip}:${security_port}/g" $security sed -r "s/DB_IP:DB_PORT([/:])DB_NAME/${db_ip}:${db_port}\1${db_name}/g" -i $security sed -i "s/DB_USERNAME/${db_username}/g" $security sed -i "s/DB_PASSWD/${db_passwd}/g" $security done case $db_type in "mysql") sed -r '/^#?database.type=mysql$/,+4s/^#//g' -i 'security/WEB-INF/classes/cfg.db.deploy.properties' sed -r '/MySQL5Dialect$/s/^#//g' -i 'security/WEB-INF/classes/cfg.db.deploy.properties' sed -r '/^#?database.type=mysql$/,+4s/^#//g' -i 'security/WEB-INF/classes/bonc-security.properties' sed -i "s/DB_SCHEMA/${db_name}/g" 'security/WEB-INF/classes/cfg.db.deploy.properties' ;; "oracle") sed -r '/^#?database.type=oracle$/,+5s/^#//g' -i 'security/WEB-INF/classes/cfg.db.deploy.properties' sed -r '/Oracle10gDialect$/s/^#//g' -i 'security/WEB-INF/classes/cfg.db.deploy.properties' sed -r '/^#?database.type=oracle$/,+4s/^#//g' -i 'security/WEB-INF/classes/bonc-security.properties' sed -i "s/DB_SCHEMA/${db_username}/g" 'security/WEB-INF/classes/cfg.db.deploy.properties' ;; *) ;; esac fi fi
【Tomcat】shell 部署配置 war包的更多相关文章
- Docker实现运行tomcat并部署项目war包,并实现挂载目录
之前写的有点乱,现在再来整理一下docker的简单部署运行 借鉴博客:https://blog.csdn.net/qq_32351227/article/details/78673591 一.dock ...
- Spring Boot取消默认tomcat启动,打成war包发布到服务器运行
一.设置打包方式 在pom.xml中设置打包格式 <packaging>war</packaging> 二.取消Spring Boot的tomcat <!--部署成war ...
- intellij idea tomcat 启动不生成war包
intellij idea tomcat 启动不生成war包 想把项目打包成war包做测试,但是按照之前的方法居然没有成功导出war包,犯了很低级的错误,特此记录. (1)首先在Project Str ...
- Tomcat上进行项目部署与WAR包含义
一.WAR包 1.与JAR包类似,是将java类(编译好的.class)和Web资源,压缩后生成压缩包. 2. 与JAR相比,多了WEB-INF文件夹,其它多出来的内容基本都是Web资源 WEB-IN ...
- Tomcat访问控制及站点部署(以WAR包形式上传)!(重点)
访问控制 首先安装好jdk以及apache-tomcat并能访问tomcat网页 点击server status了解服务状态会报403的错误 第一步:修改user.xml配置文件 [root@loca ...
- tomcat运行springboot项目war包
以最简单的spring boot demo项目来演示如何发布项目war包到tomcat,并成功运行(有很多小伙伴会出现404错误) 一.准备一个最简单的demo项目 在IDEA中新建一个项目,一直ne ...
- springboot项目部署(war包)
将springboot项目打包成war,并且部署到tomcat.比较麻烦,自己踩的坑也比较多.算了一下,找bug的时间,有两天熬到凌晨2点. 修改pom.xml使得打包成war <groupId ...
- Spring Boot 2 构建可部署的war包
默认情况下Spring Boot使用了内嵌的Tomcat服务器,项目最终被打成jar包运行,每个jar包可以被看作一个独立的Web服务器.传统的Web开发,一般会将Web应用打成一个war包,然后将其 ...
- linux中部署jenkins(war包)及jenkins忘记登录账号密码
未登录状态 登录状态 一:部署jenkins(war包) 1.直接下载war包jenkins.war,下载地址https://jenkins.io/download 2.将下载的war包放到服务器上t ...
随机推荐
- jvm007 jvm知识点总览
转载来自:http://www.ityouknow.com/ 在江湖中要练就绝世武功必须内外兼备,精妙的招式和深厚的内功,武功的基础是内功.对于武功低(就像江南七怪)的人,招式更重要,因为他们不能靠内 ...
- 记一次sql server 性能调优,查询从20秒至2秒
一.需求 需求很简单,就是需要查询一个报表,只有1个表,数据量大约60万左右,但是中间有些逻辑. 先说明一下服务器配置情况:1核CPU.2GB内存.机械硬盘.Sqlserver 2008 R2.Win ...
- 51nod_1265:四点共面(计算几何)
题目链接 设四点为a_0~3,若共面则 (a1a0*a2a0)·a3a0=0 #include<iostream> #include<cstdio> #include<c ...
- Mybatis jpa mini 代码解析
源码地址(git):https://github.com/LittleNewbie/mybatis-jpa 一.Mybatis简介 mybatis中文官方文档:http://www.mybatis.o ...
- Linux shell for while 循环
1.数字段形式for i in {1..10}do echo $idone 2.详细列出(字符且项数不多)for File in 1 2 3 4 5 do echo $File done ...
- 4.Apache Spark的工作原理
Apache Spark的工作原理 1 Why Apache Spark 2 关于Apache Spark 3 如何安装Apache Spark 4 Apache Spark的工作原理 5 spark ...
- 初学 Python(十一)——切片
初学 Python(十一)--切片 初学 Python,主要整理一些学习到的知识点,这次是切片. #-*- coding:utf-8 -*- ''''' 切片 ''' L = ['name','age ...
- RabbitMQ入门-从HelloWorld开始
从读者的反馈谈RabbitMQ 昨天发完<RabbitMQ入门-初识RabbitMQ>,我陆陆续续收到一些反馈.鉴于部分读者希望结合实例来讲 期待下篇详细,最好结合案例.谢谢! 哪都好,唯 ...
- 花了一年时间开发的三维弯管机交互式转档软件(三维管子模型UG,SOLIDWORK,PRO/E文件转成YBC)
在弯管机加工中,由管子模型生成可直接进行弯管加工的YBC数据可以大大提高弯管编程过程.传统的做法是先用dxf数据文件(用autocad绘制管子的轴心线数据)转出XYZ数据,然后由XYZ数据转成YBC数 ...
- 深入浅出数据结构C语言版(12)——从二分查找到二叉树
在很多有关数据结构和算法的书籍或文章中,作者往往是介绍完了什么是树后就直入主题的谈什么是二叉树balabala的.但我今天决定不按这个套路来.我个人觉得,一个东西或者说一种技术存在总该有一定的道理,不 ...