[shell]tomcat项目的发包

#!/bin/sh
DATE=`date +%y%m%d%T`
mv /usr/tomcat7/webapps/jymis.war /usr/tomcat7/webapps/jymis.war${DATE}
isContinue='y'
echo "已备份为  jymis.war"${DATE}
echo "请上传jymis.war"

read -n1 -p "已经上传? [Y/N]" answer
case $answer in
Y | y)
      echo "fine ,continue";;
N | n)
      exit 0;;
*)
     echo "error choice";;
esac

umount /usr/tomcat7/webapps/jymis/uploadFiles
echo "已停止挂载"
rm -rf /usr/tomcat7/webapps/jymis
echo "已删除旧项目"

tomcatlsof=`lsof -i:8080|grep 'IPv6'|cut -d' ' -f 5|uniq`
kill -9 $tomcatlsof
echo "已杀死tomcat进程"

while ((`lsof -i:8080 | wc -l`!=0))
do
sleep 1
done


echo "正在重启tomcat..."
/usr/tomcat7/bin/startup.sh

while [ ! -d /usr/tomcat7/webapps/jymis/uploadFiles ]; do
sleep 1
done

echo "重新挂载..."
mkdir /usr/tomcat7/webapps/jymis/Xfiles
cp -rf /usr/tomcat7/webapps/jymis/uploadFiles/* /usr/tomcat7/webapps/jymis/Xfiles
rm -rf /usr/tomcat7/webapps/jymis/uploadFiles/*
mfsmount /usr/tomcat7/webapps/jymis/uploadFiles -H 10.10.0.11

while((`df -h|wc -l`!=7))
do
sleep 1
done


cp -rf /usr/tomcat7/webapps/jymis/Xfiles/* /usr/tomcat7/webapps/jymis/uploadFiles
tail -f /usr/tomcat7/logs/catalina.out

你可能感兴趣的:([shell]tomcat项目的发包)