在CentOS上配置Tomcat服务脚本
Posted hapday
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在CentOS上配置Tomcat服务脚本相关的知识,希望对你有一定的参考价值。
#!/bin/bash
# chkconfig: - 85 15
# description: Tomcat Server basic start/shutdown script
# processname: tomcat
JAVA_HOME=/usr/local/jdk/jdk1.8.0_65
export JAVA_HOME
TOMCAT_HOME=/usr/local/tomcat/apache-tomcat-8.0.30
START_TOMCAT=/usr/local/tomcat/apache-tomcat-8.0.30/bin/startup.sh
STOP_TOMCAT=/usr/local/tomcat/apache-tomcat-8.0.30/bin/shutdown.sh
start() {
echo -n "Starting tomcat: "
cd $TOMCAT_HOME
${START_TOMCAT}
echo "done."
}
stop() {
echo -n "Shutting down tomcat: "
cd $TOMCAT_HOME
${STOP_TOMCAT}
echo "done."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 10
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0
以上是关于在CentOS上配置Tomcat服务脚本的主要内容,如果未能解决你的问题,请参考以下文章
linux服务器(centos7环境)配置tomcat8开机自启动(亲测有效)
centos7 使用systemctl设置tomcat9服务