centos设置tomcat开机启动

前端之家收集整理的这篇文章主要介绍了centos设置tomcat开机启动前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.编辑开机启动脚本

vi /etc/init.d/tomcat8

#!/bin/bash
# tomcat8:start|stop|restart
# chkconfig: 345 90 10
# description: tomcat8
# processname: tomcat8 

export JAVA_HOME=/usr/local/program/jdk1.8
TOMCAT_HOME=/usr/local/program/tomcat8
case "$1" in
'start')
   echo -n $"Starting tomcat!  "
        $TOMCAT_HOME/bin/startup.sh
   ;;
'stop')
   echo -n $"Stopping tomcat!  "
         $TOMCAT_HOME/bin/shutdown.sh
   ;;
'restart')
   $0 stop
   $0 start
   ;;
*)
   echo "Usage: $0 [start|stop|restart]"
   exit 1
esac
exit 0

修改/etc/init.d/tomcat8启动服务文件权限
chmod 755 /etc/init.d/tomcat8


2. 执行 chkconfig命令,设置启动

#cd /etc/init.d

#chkconfig --add tomcat8

查看 tomcat8的状态

tomcat8        	0:off	1:off	2:off	3:on	4:on	5:on	6:off
原文链接:https://www.f2er.com/centos/376737.html

猜你在找的CentOS相关文章