博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
publish_tomcat.sh
阅读量:7082 次
发布时间:2019-06-28

本文共 1024 字,大约阅读时间需要 3 分钟。

hot3.png

#!/bin/bash

# Description: 
#    We should enter into tomcat home directory and sz a war, then we can execute this script.
#    Use "mvn clean package -Dmaven.test.skip=true -Dskiptests=true -P env-prod" command to get the war.

# allow job control

set -m

application_dir="server-name"

# current directory that is tomcat home directory

cur_dir=$(pwd)
echo $cur_dir

#

cd  $cur_dir
mkdir -p webapps/$application_dir

# set backup dir

backup="backup"

# set the war backup

cur_time=$(date +%F-%H-%M-%S) 

# war backup

#/bin/mv -f *.war $backup/$(cur_time).war

# stop the tomcat server

ps aux | grep java | grep $cur_dir | awk  '{print $2}' | xargs kill -9

# webapps backup

mv  webapps/$application_dir/ ./$backup/webapp.`date +%F-%H-%M-%S`

#delete work directory

/bin/rm -rf $cur_dir/work/

# unzip 

unzip -d $cur_dir/webapps/$application_dir *.war

#start the tomcat server

$cur_dir/bin/catalina.sh start

#

#tail -f $cur_dir/logs/catalina.out
tail -f $cur_dir/logs/catalina.out.`date +%Y-%m-%d`

 

转载于:https://my.oschina.net/u/1399755/blog/1834355

你可能感兴趣的文章
该来的年终总结,还是来了
查看>>
HustOJ - 1001
查看>>
typedef void far *LPVOID 的具体定义
查看>>
webp图片转换工具
查看>>
2015.12.24(圣诞节) 解决Oralce数据库将具有相同属性的多行合并为一行的简单方法多年想要wmsys.wm_concat...
查看>>
嵌入式Linux之旅——环境搭建篇之烧写整个系统
查看>>
批量删除.svn文件夹、.svn文件
查看>>
python orm框架
查看>>
python数据结构
查看>>
POJ-1088 滑雪 dp
查看>>
数组元素逆置[拙劣的递归]
查看>>
IO 流之字符流的缓冲区
查看>>
NumberFormat类的用法
查看>>
linx 实用操作命令二
查看>>
数字转大写
查看>>
js中用户名的正则(字符,数字,下划线,减号)
查看>>
JavaScript splice() 方法和JavaScript split() 方法
查看>>
记录Nginx作为静态资源web服务场景配置
查看>>
AVI编码器
查看>>
LeetCode-112. Path Sum
查看>>