Linux环境下Tomcat快速启动、关闭、查看实时日志
本文参考 linux下快速启动tomcat脚本添加了快速查看实时日志
创建脚本
脚本创建路径 /etc/init.d/tomcat
首先执行: vi /etc/init.d/tomcat
按 i 编辑,将下面内容根据你自己的情况(修改/opt/tomcat8为你的tomcat路径)
修改后copy到编辑框中, esc 退出编辑,:wq 保存退出
# !/bin/bash # Description: start or stop the tomcat # Usage: tomcat [start|stop|restart|catalina] # export PATH=$PATH:$HOME/bin export BASH_ENV=$HOME/.bashrc export USERNAME="root" case "$1" in start) #startup the tomcat cd /opt/tomcat8/bin ./startup.sh ;; stop) # stop tomcat cd /opt/tomcat8/bin ./shutdown.sh echo "Tomcat Stoped" ;; catalina) #tomcat catalina cd /opt/tomcat8/logs tail -f catalina.out echo "Tomcat catalina" ;; # restart) $0 stop $0 start
脚本添加执行权限
执行命令 chmod +x /etc/init.d/tomcat
创建软连接
执行下面两条命令
cd /usr/bin
ln -s /etc/init.d/tomcat .
测试
好了,用下面的命令愉快的去玩耍吧
tomcat start
tomcat stop
tomcat restart
tomcat catalina
相关推荐
farwang 2020-11-25
星愿心愿 2020-11-24
tianhuak 2020-11-24
zhjn0 2020-11-24
昭君出塞 2020-11-23
bluecarrot 2020-11-23
linuxwcj 2020-10-21
以梦为马不负韶华 2020-10-20
彼岸随笔 2020-10-20
yutou0 2020-10-17
applecarelte 2020-10-16
ourtimes 2020-10-16
waterhorse 2020-09-19
MRFENGG 2020-11-11
rainandtear 2020-10-30
kyssfanhui 2020-10-20
liuhangtiant 2020-10-20