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
时间: 2024-10-12 19:17:18