tomcat 启动脚本
#!/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 启动脚本的更多相关文章
- Tomcat启动脚本
记录一个比较好的tomcat启动脚本,截取<OneinStack>,修改如下两个参数即可用. 使用之前修改下面2个参数: #Location of JAVA_HOME (bin files ...
- 100个Shell脚本——【脚本3】tomcat启动脚本
[脚本3]tomcat启动脚本 一.脚本tomcatd.sh #!/bin/bash # chkconfig:2345 64 36 # description: Tomcat start/stop/r ...
- [Tomcat 源码分析系列] (二) : Tomcat 启动脚本-catalina.bat
概述 Tomcat 的三个最重要的启动脚本: startup.bat catalina.bat setclasspath.bat 上一篇咱们分析了 startup.bat 脚本 这一篇咱们来分析 ca ...
- [Tomcat 源码分析系列] (一) : Tomcat 启动脚本-startup.bat
概述 我们通常使用 Tomcat 中的 startup.bat 来启动 Tomcat. 但是这其中干了一些什么事呢? 大家都知道一个 Java 程序需要启动的话, 肯定需要 main 方法, 那么这个 ...
- linux中tomcat启动脚本:关闭、发布、重启、测试是否成功
说明 在使用jenkins持续集成时,需要实现自动发布包到tomcat.该脚本实现了在jenkins将包发送到linux服务器上后的自动关闭.发布.启动.测试启动是否成功的过程 思路 该思路以tomc ...
- Tomcat启动脚本catalina.sh
1 - 概述脚本catalina.sh用于启动和关闭tomcat服务器,是最关键的脚本另外的脚本startup.sh和shutdown.sh都是使用不同的参数调用了该脚本该脚本的使用方法如下(引自该脚 ...
- tomcat 启动脚本走过的坑
最近由于 程序写的问题 tomcat经常需要重启,所以就让我写给监控tomcat并启动的脚本 例: 看着一起正常 然后就写到 crontab 计划任务里了 后来发现不管用, 找了好多文档 就是找不到问 ...
- 外部调用Tomcat启动脚本后日志中文显示乱码问题的解决
外部sh脚本如下 #!/bin/bash while read LINE do echo "Hello $LINE!" case $LINE in all) tail -f -n2 ...
- Tomcat启动脚本(1)startup.bat
@echo off rem Licensed to the Apache Software Foundation (ASF) under one or more rem contributor lic ...
随机推荐
- 查看计算机CPU、内存使用情况
Shift + Ctrl + Esc,打开Windows任务管理器,点击性能,如图: 可以清楚的看到整台机子的CPU.内存使用情况,其中CPU使用记录下有8个小窗口,因为博主的CPU是8核的,讲讲CP ...
- uiautomator 代码记录 : BT发送测试
package rom; import java.lang.*; import java.util.Random; import java.io.File; import com.android.ui ...
- VMware里的linux系统里的命令行里会有bee的声音,要如何关掉
取消bell报警声的方法:登陆linux系统vi /etc/inputrc找到set bell-style none 将前面的#去掉,之后重启系统即可解决声音问题 若不见效可以通过下面的方式解决下be ...
- ROS进阶学习笔记(10)- 搭建自己的Turtlebot(5) - Interactive Makers
用interactive_makers控制Turtlebot移动 interactive_makers 是Willow Garage公司开发的一个虚拟控制工具,可通过鼠标在虚拟环境中的操作,完成实际机 ...
- WebForm(内置函数)
Response - 响应对象1.定义:Response对象用于动态响应客户端请示,控制发送给用户的信息,并将动态生成响应.若指定的cookie不存在,则创建它.若存在,则将自动进行更新.结果返回给客 ...
- angular.js前端分层开发(页面和js代码分离,并将js代码分层)
一. 抽取模块成base.js文件// 定义模块: var app = angular.module("eshop",['pagination']); 二. 抽取服务成brandS ...
- pycharm中查找替换妙用
1.二行空格变一行(转载https://www.cnblogs.com/dreamfine/p/7760575.html) 网上COPY的代码,经常多出一个空行,不用一行行删除了,用替换功能吧,查找 ...
- scrapy工作原理概述
当运行scrapy crawl spider 时,会生成一个crawl命令对象,scrapy是调用execute函数(cmdlin.py)来执行命令的,execute函数会给命令对象添加crawler ...
- leetcode1007
public class Solution { public int MinDominoRotations(int[] A, int[] B) { var na = A.Length; var nb ...
- JS 相等判断 / 类型判断
相等判断 JavaScript提供三种不同的值比较操作: 严格相等 ("triple equals" 或 "identity"),使用 === , 宽松相等 ( ...