为Tomcat添加启动、停止、重启
#安装tomcat
创新互联是一家集网站建设,竹山企业网站建设,竹山品牌网站建设,网站定制,竹山网站建设报价,网络营销,网络优化,竹山网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-9/v9.0.0.M4/bin/apache-tomcat-9.0.0.M4.tar.gz?crazycache=1
tar zxvf apache-tomcat-9.0.0.M4.tar.gz
mv apache-tomcat-9.0.0.M4.tar.gz /usr/local/tomcat
cd /usr/local/tomcat/bin
sh startup.sh
#设置开机启动(增加restart)
cd /etc/init.d
vi tomcat
#!/bin/bash
#
# tomcat
#
# chkconfig:
# description: Start up the Tomcat servlet engine.
# Source function library.
. /etc/init.d/functions
RETVAL=$?
CATALINA_HOME="/usr/local/tomcat"
case "$1" in
start)
if [ -f $CATALINA_HOME/bin/startup.sh ];
then
echo $"Starting Tomcat"
/bin/su root $CATALINA_HOME/bin/startup.sh
fi
;;
stop)
if [ -f $CATALINA_HOME/bin/shutdown.sh ];
then
echo $"Stopping Tomcat"
/bin/su root $CATALINA_HOME/bin/shutdown.sh
fi
;;
restart)
if [ lsof -i:8080 ];
then
/bin/su root $CATALINA_HOME/bin/shutdown.sh
echo $"Stop Tomcat OK"
fi
echo $"Tomcat NOT Run"
/bin/su root $CATALINA_HOME/bin/startup.sh
echo $"Starting Tomcat OK"
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL
当前题目:为Tomcat添加启动、停止、重启
新闻来源:http://scyanting.com/article/ihpshp.html