红联Linux门户
Linux帮助

CentOS Linux下一个tomcat起停,查看日志的shell script

发布时间:2015-10-14 19:13:50来源:linux网站作者:米饭加酱油

CentOS 的tomcat安装目录:/usr/local/tomcat


vi MyTomcatUitl.sh          创建文件
chmod u+x MyTomcatUtil.sh   赋执行权限


shell script :


1 #!/bin/bash
2
3 # tomcat启动,停止,日志显示脚本
4
5 if [ $1 == ''];then
6         echo "请带一个参数执行命令:start 启动tomcat,stop 停止tomcat , logs 查看tomcat动态日志"
7         exit 0
8 fi
9
10 if [ $1 == 'start' ];then
11         cd /usr/local/tomcat/bin
12         ./startup.sh
13 elif [ $1 == 'stop' ];then
14         cd /usr/local/tomcat/bin
15         ./shutdown.sh
16 elif [ $1 == 'logs' ];then
17         cd /usr/local/tomcat/logs
18         tail -f catalina.out
19 else
20         echo "参数不正确!start 启动 ,stop 停止 ,logs 查看日志"
21 fi


CentOS下Tomcat的基础安装:http://www.linuxdiyf.com/linux/13875.html

CentOS 6.6下Tomcat集群:http://www.linuxdiyf.com/linux/12507.html

CentOS下配置多个Tomcat同时运行:http://www.linuxdiyf.com/linux/11537.html

CentOS 6.4安装搭建Tomcat 7:http://www.linuxdiyf.com/linux/10513.html

CentOS 6.5下安装Tomcat:http://www.linuxdiyf.com/linux/10251.html