Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize self-starting Tomcat Service

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to achieve self-starting Tomcat service", the content is easy to understand, clear, hope to help you solve your doubts, let the editor lead you to study and learn "how to achieve self-starting Tomcat service" this article.

If we use the war package to deploy the project, we need to put the package into the Tomcat directory, in order to enable our service to start automatically when the server restarts, we need to set Tomcat to self-starting service.

Configure the Tomcat service

Create a new service script

[root@localhost ~] # vim / etc/init.d/tomcat

Add script content

#! / bin/bash# description: Tomcat7 Start Stop Restart# processname: tomcat7# chkconfig: 234 20 80CATALINA_HOME=/usr/local/tomcat/apache-tomcat-7.0.77case $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}';; esacexit 0

Execute scripts to start, stop, and restart services.

Launch: service tomcat start

Stop: service tomcat stop

Restart: service tomcat restart

Tomcat configuration Boot self-boot

Add management of tomcat services to chkconfig

[root@localhost] # chkconfig-- add tomcat

Set tomcat service self-startup

[root@localhost ~] # chkconfig tomcat on

Check the startup status of tomcat

[root@localhost ~] # chkconfig-- list | grep tomcat

The status is as follows:

[root@localhost ~] # chkconfig-list | grep tomcat

Tomcat 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Turn off the tomcat service from startup:

Chkconfig tomcat off

Remove the management of the tomcat service on the chkconfig:

Chkconfig-del tomcat above are all the contents of this article entitled "how to implement self-starting Tomcat Services". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report