tomcat版本一键升级脚本

脚本 Story 129浏览 0评论

脚本没有较完整的通用性,但升级的思路基本是一致的。

#!/bin/bash
#
. /etc/profile
workpath=/cache1/web
version="apache-tomcat-6.0.41"
time=`date "+%Y%m%d%H%M"`
cd $workpath
mkdir -p $workpath/appbak
/etc/init.d/tomcat-xxx-service stop
sleep 2
portal=(xxx ex xas zms)
for portal in ${portal[@]}
do
sleep 1
tar -zxf "$version".tar.gz 2>&1 > /dev/null
mv "$version" new-xxx-$portal
rm -rf new-xxx-$portal/webapps/* 2>&1 > /dev/null
\cp -a zms-$portal/bin/catalina.sh new-xxx-$portal/bin/
\cp -a zms-$portal/conf/{server.xml,web.xml} new-xxx-$portal/conf/
\cp -a zms-$portal/webapps/* new-xxx-$portal/webapps/
\cp -a zms-$portal/conf/.keystore new-xxx-$portal/conf/ 2>&1 > /dev/null
chown tomcat:tomcat -R new-xxx-$portal && chmod +x new-xxx-$portal/bin/*.sh
chmod 750 new-xxx-$portal/webapps/$portal
mv -f zms-$portal appbak/zms-$portal-$time && mv new-xxx-$portal zms-$portal
echo "update $portal success"
sh $workpath/zms-$portal/bin/version.sh
done
/etc/init.d/tomcat-xxx-service start

转载请注明:成长的对话 » tomcat版本一键升级脚本