1)部署war包
#!/bin/bash
if [ id>0];then
echo"stopproject"
kill −9 id
else
echo "project is stopped"
fi

echo "remover project war file"

cd /usr/local/项目部署到tomcat的名称/webapps
rm -rf 项目名称
rm -rf 项目名称.war
echo "copy project war to webapp"

cd /usr/local/src/temp
mv -f 项目名称.war /usr/local/项目部署到tomcat的名称/webapps/

chmod 755 /usr/local/项目部署到tomcat的名称/webapps/*.war

echo "start project tomcat"

echo "install enviroment start"
export JAVA_HOME=/usr/local/jdk1.8.0_144
export PATH=JAVAHOME/bin:PATH
export CLASSPATH=.:JAVAHOME/lib:JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
echo "install enviroment finished"

/usr/local/项目部署到tomcat的名称/bin/catalina.sh start

echo “start project tomcat finished”
echo $id “start project tomcat successfull”


2)部署jar包
#!/bin/bash
if [ id>0];then
echo"stopproject"
kill −9 id
else
echo "project is stopped"
fi

echo "remover project jar file"

cd /usr/local/项目部署到tomcat的名称/webapps
rm -rf jar项目名称.jar
echo "copy project jar to webapps"

cd /usr/local/src/temp
mv -f jar项目名称.jar /usr/local/项目部署到tomcat的名称/webapps/
chmod 755 /usr/local/项目部署到tomcat的名称/webapps/jar项目名称

echo "start project"

echo "install enviroment start"
export JAVA_HOME=/usr/local/jdk1.8.0_144
export PATH=JAVAHOME/bin:PATH
export CLASSPATH=.:JAVAHOME/lib:JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
echo "install enviroment finished"

nohup java -jar /usr/local/项目部署到tomcat的名称/webapps/jar项目名称.jar >/dev/null 2>/usr/local/项目部署到tomcat的名称/logs/temp_jar项目名称.log &

echo “start project finished”

echo $id “start project successfull”

posted on 2018-11-27 12:21  新美好时代  阅读(464)  评论(2编辑  收藏  举报