Introduction to setting up Tomcat to start automatically on Linux system

Introduction to setting up Tomcat to start automatically on Linux system

1. Enter the /etc/init.d directory: cd /etc/init.d

2. Create a tomcat service configuration file: vi tomcat

3. Copy the following code into the created tomcat configuration file:

#idea - tomcat config start - 2016-05-01
#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 2345 20 80
JAVA_HOME=/usr/local/java/jdk
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
#idea - tomcat config start - 2016-05-01
#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 2345 20 80
JAVA_HOME=/usr/local/java/jdk
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/local/tomcat
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
;;
esac
exit 0
#chmod 755 tomcat
#chkconfig --add tomcat
#chkconfig --level 2345 tomcat on

4. Press exc and enter: wq! Save and exit

5. Assign executable permissions to tomcat: chmod +x tomcat

6. Add tomcat as a system service: chkconfig --add tomcat

7. Enter the command to check whether the addition is successful: chkconfig --list

insert image description here

2, 3, 4, 5 are all open to start following the system

8. Start tomcat command: service tomcat start

9. You can enter ip:8080 in the browser to view the tomcat page

This is the end of this article about setting up tomcat to start automatically on boot in Linux system. For more relevant content about Linux tomcat starting automatically on boot, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to set up Tomcat to start automatically in Linux

<<:  Summary of the use of CSS scope (style splitting)

>>:  Will the most successful companies in the future be technology companies or design companies?

Recommend

Guide to Efficient Use of MySQL Indexes

Preface I believe most people have used MySQL and...

Solve the problem of forgetting password in MySQL 5.7 under Linux

1. Problem Forgot password for mysql5.7 under lin...

Detailed process of building mongodb and mysql with docker-compose

Let's take a look at the detailed method of b...

Detailed explanation of json file writing format

Table of contents What is JSON Why this technolog...

Detailed use cases of MySql escape

MySQL escape Escape means the original semantics ...

Detailed tutorial on how to install MySQL 5.7.18 in Linux (CentOS 7) using YUM

The project needs to use MySQL. Since I had alway...

Using streaming queries in MySQL to avoid data OOM

Table of contents 1. Introduction 2. JDBC impleme...

Example explanation of alarm function in Linux

Introduction to Linux alarm function Above code: ...

How to implement real-time polygon refraction with threejs

Table of contents Preface Step 1: Setup and front...

How to view version information in Linux

How to view version information under Linux, incl...

Comprehensive understanding of HTML Form elements

As shown below: XML/HTML CodeCopy content to clip...

A brief discussion on HTML doctype and encoding

DOCTYPE Doctype is used to tell the browser which...

Solution to Nginx 500 Internal Server Error

Today, when I was using Nginx, a 500 error occurr...

How to insert Emoji expressions into MySQL

Preface Today, when I was designing a feedback fo...

How to choose the right index in MySQL

Let’s take a look at a chestnut first EXPLAIN sel...