CentOS 的tomcat安装目录:/usr/local/tomcat
vi MyTomcatUitl.sh 创建文件
chmod u+x MyTomcatUtil.sh 赋执行权限
shell script :
#!/bin/bash # tomcat启动,停止,日志显示脚本 == ''];then echo "请带一个参数执行命令:start 启动tomcat,stop 停止tomcat , logs 查看tomcat动态日志" exit fi == 'start' ];then cd /usr/local/tomcat/bin ./startup.sh == 'stop' ];then cd /usr/local/tomcat/bin ./shutdown.sh == 'logs' ];then cd /usr/local/tomcat/logs tail -f catalina.out else echo "参数不正确!start 启动 ,stop 停止 ,logs 查看日志" fi