1)部署war包
#!/bin/bashif [ id>0];then echo"stopproject" kill −9 idelse echo "project is stopped"fiecho "remover project war file"
cd /usr/local/项目部署到tomcat的名称/webapps
rm -rf 项目名称rm -rf 项目名称.warecho "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_144export PATH=JAVAHOME/bin:PATHexport CLASSPATH=.:JAVAHOME/lib:JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarecho "install enviroment finished"/usr/local/项目部署到tomcat的名称/bin/catalina.sh start
echo “start project tomcat finished”
echo $id “start project tomcat successfull” 2)部署jar包#!/bin/bashif [ id>0];then echo"stopproject" kill −9 idelse echo "project is stopped"fiecho "remover project jar file"
cd /usr/local/项目部署到tomcat的名称/webapps
rm -rf jar项目名称.jarecho "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_144export PATH=JAVAHOME/bin:PATHexport CLASSPATH=.:JAVAHOME/lib:JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarecho "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”