发表于: 2018-04-20 21:15:07
5 892
今天完成的事情:
vi deploy.sh
#!/bin/bash
project=tomcat
cd /data/deploy/bin
sh stop.sh
ant -f deploy.xml
sleep 5
sh start.sh
[root@LiLong bin]# ./deploy.sh
web server pid is 21380
21380 is killed!
Buildfile: /data/deploy/bin/deploy.xml
clean:
deploy:
[unwar] Expanding: /data/deploy/bin/deploy/carrots-home-web.war into /data/deploy/bin/run
BUILD SUCCESSFUL
Total time: 1 second
start.sh start succeed
vi deploy.xml
<?xml version="1.0"?>
<project name="carrots-home-web" basedir="/data/deploy/bin" default="deploy">
<property name="admin.dir" value="/data/deploy/bin"/>
<property name="deploy.dir" value="${admin.dir}/deploy"/>
<property name="run.dir" value="${admin.dir}/run"/>
<property name="war.file" value="${deploy.dir}/carrots-home-web.war"/>
<property name="ant.regexp.regexpimpl" value="org.apache.tools.ant.util.regexp.JakartaOroRegexp"/>
<target name="clean">
<delete verbose="true">
<fileset dir="${run.dir}">
</fileset>
</delete>
</target>
<target name="deploy" depends="clean">
<unwar src="${war.file}" dest="${run.dir}">
<patternset>
</patternset>
</unwar>
</target>
</project>
又换了在tomcat同目录下面创建了autoDeploy目录
在在下面执行了上面的一些.sh,结果是和在data目录下面一样的
又弄了一次自动部署脚本
内容是
#! /bin/sh
echo '####################开始自动部署####################'
path=`pwd`
tomcatPath=/root/usr/local/tomcat-7.0.86
cd /root/usr/local/tomcat-7.0.86/bin
PID=$(ps -fu `whoami`|grep tomcat|grep -v grep|awk '{print $2}')
if [ -z "$PID" ];then
echo "no tomcat process"
else
./shutdown.sh
fi
sleep 1
cd /root/usr/local/tomcat-7.0.86/bin
./startup.sh #启动tomcat服务
echo '####################部署结束####################'
结果
####################开始自动部署####################
Using CATALINA_BASE: /root/usr/local/tomcat-7.0.86
Using CATALINA_HOME: /root/usr/local/tomcat-7.0.86
Using CATALINA_TMPDIR: /root/usr/local/tomcat-7.0.86/temp
Using JRE_HOME: /usr/java/jdk1.8.0_131
Using CLASSPATH: /root/usr/local/tomcat-7.0.86/bin/bootstrap.
Using CLASSPATH: /root/usr/local/tomcat-7.0.86/bin/bootstrap.jar:/root/usr/local/tomcat-7.0.86/bin/tomcat-juli.jar
Using CATALINA_BASE: /root/usr/local/tomcat-7.0.86
Using CATALINA_HOME: /root/usr/local/tomcat-7.0.86
Using CATALINA_TMPDIR: /root/usr/local/tomcat-7.0.86/temp
Using JRE_HOME: /usr/java/jdk1.8.0_131
Using CLASSPATH: /root/usr/local/tomcat-7.0.86/bin/bootstrap.jar:/root/usr/local/tomcat-7.0.86/bin/tomcat-juli.jar
Tomcat started.
####################部署结束####################
又做了将Web应用部署到Tomcat根目录
利用
在tomcat中的conf目录下,在server.xml中,<host/>节点中添加:
<Context path="/hellooo" docBase="D:/myWork"debug="0" privileged="true"></Context>(例子)
遇到的问题:
tomcat无缘无故没有进程,启动是正常的,端口没监听,打算今天晚上解决一下,
java也无缘无故没有了进程
收获:
Linux下如何修改war文件
http://blog.sina.com.cn/s/blog_14dbe14960102y6dc.html
linux下使用shell更新Tomcat下的war包
https://blog.csdn.net/xiaoguo321/article/details/72674278
java web项目war包自动升级部署方案
https://blog.csdn.net/qq273681448/article/details/74931341
linux下实现自动部署tomcat的脚本
https://www.cnblogs.com/sincever/p/6534898.html
http://www.jb51.net/article/108142.htm
自动部署版本包shell脚本
https://blog.csdn.net/wjcaolinghua/article/details/48266649
shell脚本编写规范
https://blog.csdn.net/weixin_38154393/article/details/70738671
CentOS Tomcat 的启动服务脚本
http://www.jb51.net/os/RedHat/21906.html
https://www.jianshu.com/p/b3b908b004cf
http://www.bubuko.com/infodetail-2033848.html
启动脚本解释
https://blog.csdn.net/m_yeah/article/details/2254958
Maven生成WAR包时自动更新版本号version
https://blog.csdn.net/u014752421/article/details/47004189
https://www.cnblogs.com/fanshuyao/p/6508516.html
用nginx反向代理tomcat,成功访问(但是感觉不像是反向代理,就是修改了一下nginx.conf,像一个外部容器)
网址由
变成39.107.239.240
空格不要乱加!shell编程和别的编程不太一样,空格有特殊含义
明天计划的事情:
如果任务五不够标准修改任务五,如果过了,进行任务六。。
评论