自动部署tomcat 脚本

时间:2024-10-25 18:34:26

自动部署tomcat 脚本

. /etc/init.d/functions  #调用系统函数

yum -y install java >/dev/null

TAR="apache-tomcat-9.0.0.M26"
URL="http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.0.M26/bin/${TAR}.tar.gz"
DST="/usr/local/tomcat_test" cd /usr/local/src && \
wget $URL >/dev/null
WGET=`echo $?`
if [ $WGET -eq ];then
action "Download ${TAR}.tar.gz" /bin/true #对应./etc/init.d/functions 输出ok
else
action "Download ${TAR}.tar.gz" /bin/false 输出 no
fi /bin/tar xf ${TAR}.tar.gz mv $TAR $DST cd $DST && \
./bin/startup.sh >/dev/null
START=`echo $?` # ` ` 符号表示先执行符号里内容
if [ $START -eq ];then
action "start tomcat" /bin/true
else
action "start tomcat" /bin/false
fi