温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

linux如何设置tomcat自启动?

发布时间:2020-05-22 10:24:40 来源:亿速云 阅读:183 作者:Leah 栏目:系统运维

这篇文章主要为大家详细介绍了linux设置tomcat自启动的方法,文中示例代码和步骤介绍的非常详细,零基础也能参考此文章,感兴趣的小伙伴们可以参考一下。

一、在/etc/init.d/下新建tomcat文件
vim /etc/init.d/tomcat
写入如下脚本
#!/bin/bash
#description:  start stop restart
#processname: Tomcat
#chkconfig: 234 20 80
export JAVA_HOME=/usr/local/java
CATALINA_HOME=/usr/local/tomcat-xxxxx
case  $1 in 
              start)
                     sh $CATALINA_HOME/bin/startup.sh
                     ;;
              stop)
                     sh $CATALINA_HOME/bin/shutdown.sh
                     ;;
            restart)
                     sh $CATALINA_HOME/bin/shutdown.sh
                     sh $CATALINA_HOME/bin/startup.sh
                     ;;
                  *)
                                   echo 'please use: tomcat {start | stop | restart}'
                     ;;                  
esac
exit 0
二、赋予tomcat文件权限
chmod +x /etc/init.d/tomcat
三、配置开机启动
启动:service tomcat start
停止:service tomcat stop
重启:service tomcat restart
chkconfig --add tomcat
chkconfig tomcat on
关闭tomcat服务自启动:chkconfig tomcat off
删除tomcat服务在chkconfig上的管理:chkconfig –del tomcat

上文描述的就是linux设置tomcat自启动的方法,具体使用情况还需要大家自己动手实验使用过才能领会。如果想了解更多相关内容,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI