欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

centos6配置tomcat8开机自启动脚本

程序员文章站 2022-07-09 17:21:42
1、vim /etc/init.d/tomcat #!/bin/bash # # tomcat startup script for the tomcat...

1、vim /etc/init.d/tomcat

#!/bin/bash 
# 
# tomcat startup script for the tomcat server 
# 
# chkconfig: 345 80 20 
# description: start the tomcat deamon 
# 
# source function library 
. /etc/rc.d/init.d/functions 
prog=tomcat 
java_home=/usr/local/jdk1.8.0_161
export java_home 
catalana_home=/opt/apache-tomcat-8.5.24/
export catalina_home 
case "$1" in 
start) 
  echo "starting tomcat..." 
  $catalana_home/bin/startup.sh 
  ;; 
stop) 
  echo "stopping tomcat..." 
  $catalana_home/bin/shutdown.sh 
  ;; 
restart) 
  echo "stopping tomcat..." 
  $catalana_home/bin/shutdown.sh 
  sleep 2 
  echo 
  echo "starting tomcat..." 
  $catalana_home/bin/startup.sh 
  ;; 
*) 
  echo "usage: $prog {start|stop|restart}" 
  ;; 
esac 
exit 0

2、配置

chmod +x /etc/init.d/tomcat
chkconfig tomcat on
service tomcat start

总结

以上所述是小编给大家介绍的centos6配置tomcat8开机自启动脚本,希望对大家有所帮助