临时处理tomcat僵死问题
2014-10-22 11:23
225 查看
现场的同事遇到一个Tomcat僵死的问题,隔三差五的服务器就会挂掉,向我寻求解决方案,服务器正常,没有发现问题。可能是应用程序本身的问题导致,先取一个临时的办法,先服务器跑起来,然后慢慢找原因:
1、 编写一个重启tomcat的shell脚本,脚本内容如下:restart.sh
vi restart.sh注意“.”和 /etc/profile 之间有空格(. /etc/profile 注意, "."和"/etc/profile" 之间有空格.)
2、 给脚本赋予权限
#chmod u+x restart.sh或者chmod 777 restart.sh
3、 编写定时任务脚本
#crontab -e添加如下脚本内容:30 04 * * * /home/retwo/restart.sh >>/home/retwo/logs/restart.log 2>&1
4、重启定时任务脚本
(1)查看定时任务状态
service crond status
(2)停止定时任务
service crond stop
(3)启动定时任务
service crond start
(4)或者使用service crond restart命令
这只是临时的解决办法,要从根本解决问,还要认真分析出现问题的原因。找出问题根源,开着水龙头拖地,永远是拖不干净的。
本文出自 “zsls” 博客,请务必保留此出处http://qqianwan.blog.51cto.com/8015812/1566627
1、 编写一个重启tomcat的shell脚本,脚本内容如下:restart.sh
vi restart.sh注意“.”和 /etc/profile 之间有空格(. /etc/profile 注意, "."和"/etc/profile" 之间有空格.)
#!/bin/sh . /etc/profile pid=`ps aux | grep tomcat | grep -vgrep | grep -v retomcat | awk '{print $2}'` echo $pid if [ -n "$pid" ] then { echo -------shutdown--------- /opt/wstk/tomcat6/bin/shutdown.sh sleep 1 pid=`ps aux | grep tomcat | grep -v grep | grep -v retomcat | awk'{print $2}'` if [ -n "$pid" ] then { sleep 1 echo -------kill tomcat-------- kill -9 $pid } fi sleep 1 echo --------startup.sh---------- /opt/wstk/tomcat6/bin/startup.sh } else echo --------startup.sh--------- /opt/wstk/tomcat6/bin/startup.sh fi |
#chmod u+x restart.sh或者chmod 777 restart.sh
3、 编写定时任务脚本
#crontab -e添加如下脚本内容:30 04 * * * /home/retwo/restart.sh >>/home/retwo/logs/restart.log 2>&1
4、重启定时任务脚本
(1)查看定时任务状态
service crond status
(2)停止定时任务
service crond stop
(3)启动定时任务
service crond start
(4)或者使用service crond restart命令
这只是临时的解决办法,要从根本解决问,还要认真分析出现问题的原因。找出问题根源,开着水龙头拖地,永远是拖不干净的。
本文出自 “zsls” 博客,请务必保留此出处http://qqianwan.blog.51cto.com/8015812/1566627
相关文章推荐
- 关于Tomcat中中文处理的问题
- TOMCAT中处理POST、GET编码问题解决方案
- Tomcat 安装后问题处理
- Windows下部署多个tomcat服务(Tomcat7)问题处理
- Tomcat在处理GET和POST请求时产生的乱码问题
- tomcat中文显示问题处理
- Nginx + Tomcat 负载均衡中webservice问题认识和处理
- Tomcat设置默认访问项目及项目重复加载问题处理
- ORA-14450: 试图访问已经在使用的事务处理临时表,根据网上文章提供的方法,问题是解决了
- YUM 安装tomcat6 问题处理
- 在tomcat中配置Postgres + PostGIS JNDI数据源导致PGgeometry无法正常处理的问题
- Tomcat在处理GET和POST请求时产生的乱码问题
- Tomcat在处理GET和POST请求时产生的乱码问题
- (备忘)tomcat处理url参数中文乱码问题
- 上传文件细节处理问题(包括中文乱码、限制文件大小、显示上传速度、删除临时文件,随机生成文件夹等)
- 关于TOMCAT中的中文处理问题的解决方法
- Tomcat在处理GET和POST请求时产生的乱码问题
- Ubuntu安装配置记5(TOMCAT6 ,APACHE2优化,常见问题处理)
- Tomcat设置默认访问项目及项目重复加载问题处理
- 在tomcat下使用jni加载本地库的问题总结——处理UnsatisfiedLinkError错误