暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

替换war文件内容的一个脚本

原创 zayki 2022-11-25
311
#!/bin/bash test1_war=/jboss/wildfly-10.1.0.Final/standalone/deployments/test1.war test2_war=/jboss/wildfly-10.1.0.Final/standalone/deployments/test2.war upload_path=/home/itadmin/upload_war war_count=`find ${upload_path} -name *.war |wc -l` if [[ ${war_count} -eq 0 ]];then echo "The upload path has no files." exit 1 fi function deploy_service(){ cd ${upload_path} service_name=$1 # unzip source war unzip ${service_name}-*.war -d ${service_name}_unpacked if [[ $? -eq 0 ]];then echo "***********************************************************" echo "Step1:${service_name}-*.war has been unpacked successfully." echo "**********************************************************" else echo "Unpacked failed." exit 1 fi # replace target war cd ${service_name}_unpacked target_war="${service_name}"_war jar -uvf ${!target_war} * if [[ $? -eq 0 ]];then echo "**************************************************" echo "Step2:${target_war} has been updated successfully." echo "**************************************************" else echo "Update war failed." exit 1 fi # Get file list echo "*****************************************************" for filepath in `find . -type f` do filename=`basename ${filepath}` unzip -l ${!target_war} |grep ${filename} |awk '{print $4,$2,$3}' done echo "*****************************************************" } deploy_service test1 deploy_service test2 cd ${upload_path} && rm -rf *
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论