【Tomcat】重新打war包

Extract war in tomcat/webapps

#!/bin/bash
#-----------------------------------------------
# FileName: getwar.sh
# Reversion: 1.2
# Date: 2017/05/27
# Author: zhengwenqiang
# Email: zhengwenqiang@bonc.com.cn
# Description: Package war which has been configured in webapps,then throw them in the directory 'dist'.
# Notes: If you are going to execute this script on linux, 
#	you should  run the command "sed -i 's/
//g' getwar.sh" 
#	to delete invalid character ^M generated by Notepad++ in Windows.
# Copyright: 2017(c) zhengwenqiang
# License: GPL
#-----------------------------------------------

[ -d dist ] || mkdir dist

rm dist/*.war -f

dest="`pwd`/dist"

cd webapps

function packWar(){
	
	if [ -d $1 ] ; then
		cd $1
		[ -f $1.war ] && rm -f $1.war
		jar cvf $1.war ./* && mv $1.war $dest 
		cd -
	fi
	
}

for war in 'cas' 'portal' 'security'
do 
	packWar $war
done 

echo "Job Finished!"

  

原文地址:https://www.cnblogs.com/zhengwenqiang/p/6927777.html