#!/bin/bash
#
#干掉运行中的tomcat  results=把结果赋值给变量,可以保证命令上条执行完再执行下一条
#也可以用这句简单的代码按进程名kill: ps -ef | grep 进程名 | grep -v grep | awk '{print $2}' | xargs kill -9
results=`ps -ef|grep tomcat|grep -v grep|grep -v PPID|awk '{ print $2}'`
echo -e 'tomcat PID: ' ${results}
for i in ${results}
do
kill -9 $i
echo -e "Kill the tomcat process [ $i ]"
done
#
results=`ps -ef|grep tomcat|grep -v grep|grep -v PPID|awk '{ print $2}'`
echo -e 'tomcat PID: ' ${results}
#
#备份
dqsj=`date "+%Y-%m-%d_%H:%M:%S"`
results=`/bin/cp -rf /home/tomcat-7.0.85_6001/apps /home/gb/old/apps6001_${dqsj}`
echo -e ${results}
results=`/bin/cp -rf /home/tomcat-7.0.85_tslx/apps /home/gb/old/appstslx_${dqsj}`
echo -e ${results}
echo -e 'back-up /tomcat/apps/ /home/gb/old/ OK'
#
#清空tomcat日志
results=`/bin/rm -rf /home/tomcat-7.0.85_6001/logs/*`
echo -e ${results}
results=`/bin/rm -rf /home/tomcat-7.0.85_6002/logs/*`
echo -e ${results}
results=`/bin/rm -rf /home/tomcat-7.0.85_6003/logs/*`
echo -e ${results}
results=`/bin/rm -rf /home/tomcat-7.0.85_6004/logs/*`
echo -e ${results}
results=`/bin/rm -rf /home/tomcat-7.0.85_tslx/logs/*`
echo -e ${results}
echo -e 'delete /tomcat/logs/* OK'
#
#清空tomcat缓存
results=`/bin/rm -rf /home/tomcat-7.0.85_6001/work/Catalina/*`
echo -e ${results}
results=`/bin/rm -rf /home/tomcat-7.0.85_6002/work/Catalina/*`
echo -e ${results}
results=`/bin/rm -rf /home/tomcat-7.0.85_6003/work/Catalina/*`
echo -e ${results}
results=`/bin/rm -rf /home/tomcat-7.0.85_6004/work/Catalina/*`
echo -e ${results}
results=`/bin/rm -rf /home/tomcat-7.0.85_tslx/work/Catalina/*`
echo -e ${results}
echo -e 'delete /tomcat/work/Catalina/* OK'
#
#拷贝工程 节点6001
results=`/bin/cp -rf /home/gb/new/sfpt.war /home/tomcat-7.0.85_6001/apps/`
echo -e ${results}
results=`/bin/cp -rf /home/gb/new/sfptpj.war /home/tomcat-7.0.85_6001/apps/`
echo -e ${results}
results=`/bin/cp -rf /home/gb/new/sfptpu.war /home/tomcat-7.0.85_6001/apps/`
echo -e ${results}
results=`/bin/cp -rf /home/gb/new/sfptmu.war /home/tomcat-7.0.85_6001/apps/`
echo -e ${results}
#
#拷贝工程 节点6002
results=`/bin/cp -rf /home/gb/new/sfpt.war /home/tomcat-7.0.85_6002/apps/`
echo -e ${results}
results=`/bin/cp -rf /home/gb/new/sfptpj.war /home/tomcat-7.0.85_6002/apps/`
echo -e ${results}
results=`/bin/cp -rf /home/gb/new/sfptpu.war /home/tomcat-7.0.85_6002/apps/`
echo -e ${results}
results=`/bin/cp -rf /home/gb/new/sfptmu.war /home/tomcat-7.0.85_6002/apps/`
echo -e ${results}
#
#拷贝工程 节点6003
results=`/bin/cp -rf /home/gb/new/sfpt.war /home/tomcat-7.0.85_6003/apps/`
echo -e ${results}
results=`/bin/cp -rf /home/gb/new/sfptpj.war /home/tomcat-7.0.85_6003/apps/`
echo -e ${results}
results=`/bin/cp -rf /home/gb/new/sfptpu.war /home/tomcat-7.0.85_6003/apps/`
echo -e ${results}
results=`/bin/cp -rf /home/gb/new/sfptmu.war /home/tomcat-7.0.85_6003/apps/`
echo -e ${results}
#
#拷贝工程 节点6004
results=`/bin/cp -rf /home/gb/new/sfpt.war /home/tomcat-7.0.85_6004/apps/`
echo -e ${results}
results=`/bin/cp -rf /home/gb/new/sfptpj.war /home/tomcat-7.0.85_6004/apps/`
echo -e ${results}
results=`/bin/cp -rf /home/gb/new/sfptpu.war /home/tomcat-7.0.85_6004/apps/`
echo -e ${results}
results=`/bin/cp -rf /home/gb/new/sfptmu.war /home/tomcat-7.0.85_6004/apps/`
echo -e ${results}
#
#拷贝工程 节点6005
results=`/bin/cp -rf /home/gb/new/sfpttslx.war /home/tomcat-7.0.85_tslx/apps/`
echo -e ${results}
#
echo -e 'Copy /home/gb/new/ /tomcat/apps/ OK'
#
#启动服务
results=`bash  /home/tomcat-7.0.85_6001/bin/startup.sh`
echo -e   ${results}
results=`bash  /home/tomcat-7.0.85_6002/bin/startup.sh`
echo -e   ${results}
results=`bash  /home/tomcat-7.0.85_6003/bin/startup.sh`
echo -e   ${results}
results=`bash  /home/tomcat-7.0.85_6004/bin/startup.sh`
echo -e   ${results}
results=`bash  /home/tomcat-7.0.85_tslx/bin/startup.sh`
echo -e   ${results}
echo -e 'startup OK'
#
results=`ps -ef|grep tomcat|grep -v grep|grep -v PPID|awk '{ print $2}'`
echo -e 'tomcat PID: ' ${results}
#
dqsj=`date "+%Y-%m-%d %H:%M:%S"`
echo -e  'endTime ' ${dqsj}
#

tomcat 启动脚本的更多相关文章

  1. Tomcat启动脚本

    记录一个比较好的tomcat启动脚本,截取<OneinStack>,修改如下两个参数即可用. 使用之前修改下面2个参数: #Location of JAVA_HOME (bin files ...

  2. 100个Shell脚本——【脚本3】tomcat启动脚本

    [脚本3]tomcat启动脚本 一.脚本tomcatd.sh #!/bin/bash # chkconfig:2345 64 36 # description: Tomcat start/stop/r ...

  3. [Tomcat 源码分析系列] (二) : Tomcat 启动脚本-catalina.bat

    概述 Tomcat 的三个最重要的启动脚本: startup.bat catalina.bat setclasspath.bat 上一篇咱们分析了 startup.bat 脚本 这一篇咱们来分析 ca ...

  4. [Tomcat 源码分析系列] (一) : Tomcat 启动脚本-startup.bat

    概述 我们通常使用 Tomcat 中的 startup.bat 来启动 Tomcat. 但是这其中干了一些什么事呢? 大家都知道一个 Java 程序需要启动的话, 肯定需要 main 方法, 那么这个 ...

  5. linux中tomcat启动脚本:关闭、发布、重启、测试是否成功

    说明 在使用jenkins持续集成时,需要实现自动发布包到tomcat.该脚本实现了在jenkins将包发送到linux服务器上后的自动关闭.发布.启动.测试启动是否成功的过程 思路 该思路以tomc ...

  6. Tomcat启动脚本catalina.sh

    1 - 概述脚本catalina.sh用于启动和关闭tomcat服务器,是最关键的脚本另外的脚本startup.sh和shutdown.sh都是使用不同的参数调用了该脚本该脚本的使用方法如下(引自该脚 ...

  7. tomcat 启动脚本走过的坑

    最近由于 程序写的问题 tomcat经常需要重启,所以就让我写给监控tomcat并启动的脚本 例: 看着一起正常 然后就写到 crontab 计划任务里了 后来发现不管用, 找了好多文档 就是找不到问 ...

  8. 外部调用Tomcat启动脚本后日志中文显示乱码问题的解决

    外部sh脚本如下 #!/bin/bash while read LINE do echo "Hello $LINE!" case $LINE in all) tail -f -n2 ...

  9. Tomcat启动脚本(1)startup.bat

    @echo off rem Licensed to the Apache Software Foundation (ASF) under one or more rem contributor lic ...

随机推荐

  1. 微信小程序如何引用其他js文件

    1.我们先建立一个common.js文件,在common.js编写我们的程序, function myfunc() { console.log("myfunc....");} mo ...

  2. 前端(慕课网)笔记二:http协议

    缓存 cors 1.http协议的主要特点: 简单快速:每个资源URI是固定的: 灵活:通过一个协议完成不同数据格式的传输 无连接:连接一次就会断开,不会保持连接 无状态:客服端和服务端是两种身份,客 ...

  3. 人工智能时代,是时候学点Python了!

    “是时候学点Python了”.作为一名不怎么安分的程序员,你或许觉得,产生这样的想法并不奇怪,但学习Python却是出于自己对工作现状以及如何应对未来挑战所作出的思考.读过我以前博客的朋友,可能都知道 ...

  4. 安全测试3_Web后端知识学习

    其实中间还应该学习下web服务和数据库的基础,对于web服务大家可以回家玩下tomcat或者wamp等东西,数据库的话大家掌握基本的增删该查就好了,另外最好掌握下数据库的内置函数,如:concat() ...

  5. Docker Basic

    1.简介 last 1.简介 1.1目的?一次编译.到处运行: 1.2.是什么? 实现[运行环境和配置文件的]软件容器,方便[持续集成]实现[整体发布]的容器虚拟化技术: 概括:整体发布的[容器虚拟化 ...

  6. Vue.js模拟百度下拉框

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. c#上传文件并将word pdf转化成txt存储并将内容写入数据库

    c#上传文件并将word pdf转化成txt存储并将内容写入数据库 using System; using System.Data; using System.Configuration; using ...

  8. 阿里云 putty链接服务器出现 server refused our key

    阿里云 putty链接服务器出现 server refused our key 创建了密钥对绑定实例,puttygen生成ppk,putty配置参数,连接,一步一步来的,结果出现 server ref ...

  9. python操作浏览器及截图小结

    近期做网页自动化用到内容小结 1.打开浏览器1)打开默认配置的浏览器from selenium import webdriverdriver = webdriver.Firefox()"&q ...

  10. spring 之 lookup-method & replaced-method II

    显然, lookup-method 的name 对应的方法 是可以有方法参数的, 但是, 我发现, 参数无法传递, 传过去的参数好像被丢入了黑洞一般... 非常奇怪. lookup-method 的n ...