#!/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}
#

最新文章

  1. Windows Azure Storage (18) 使用HTML5 Portal的Azure CDN服务
  2. 在Jenkins中获取GitHub对应Repository的Resource Code
  3. JSON.stringify()
  4. C++调用约定和名字约定
  5. OAuth2.0概述
  6. oracle 自动关闭 数据库连接
  7. MMU(what,how,todo)
  8. 数据文件 和日志文件 收缩 Sql Server
  9. eclipse 比较好的插件
  10. Oracle12C 怎样导入scott用户
  11. 解决AJAX在火狐,谷歌都能正常运行,而IE不行的问题
  12. Java面向对象抽象类实例练习
  13. Android的SharedPreferences(首选项)保存键值对
  14. Redis 知识整理
  15. 51Nod - 1433 0和5 找规律
  16. python data science handbook1
  17. MySQL安装教程图解
  18. js的简单介绍
  19. 收集服务器网卡和IP信息
  20. git如何跨分支查找某个commit所属分支?

热门文章

  1. git命令简洁版
  2. js数据类型转换 ----流程控制
  3. [Unity插件]Lua行为树(二):树结构
  4. kafka源代码环境配置
  5. SQL Server通过外部程序集注册正则表达式函数(CLR函数) [转]
  6. python if all
  7. Nginx配置HTTPS证书网站
  8. jieba安装
  9. Appium-We wanted {"required":["value"]} and you sent ["text","sessionId","id","value"]
  10. js 深度拷贝