首页 > 代码库 > CentOS Linux下一个tomcat起停,查看日志的shell script

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

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 ];then11         cd /usr/local/tomcat/bin12         ./startup.sh13 elif [ $1 == stop ];then14         cd /usr/local/tomcat/bin15         ./shutdown.sh16 elif [ $1 == logs ];then17         cd /usr/local/tomcat/logs18         tail -f catalina.out19 else20         echo "参数不正确!start 启动 ,stop 停止 ,logs 查看日志"21 fi

 

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