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

Docker container data volume named mount and anonymous mount issues

Table of contents What is a container data volume...

Linux super detailed gcc upgrade process

Table of contents Preface 1. Current gcc version ...

Solution to the problem of MySQL thread in Opening tables

Problem Description Recently, there was a MySQL5....

Introduction to keyword design methods in web design

Many times, we ignore the setting of the web page ...

Summary of MySQL Undo Log and Redo Log

Table of contents Undo Log Undo Log Generation an...

Detailed explanation of Docker Swarm service orchestration commands

1. Introduction Docker has an orchestration tool ...

How to transfer files between Docker container and local machine

To transfer files between the host and the contai...

Detailed explanation of nginx-naxsi whitelist rules

Whitelist rule syntax: BasicRule wl:ID [negative]...

JavaScript Reflection Learning Tips

Table of contents 1. Introduction 2. Interface 3....

A brief discussion on how to choose and combine div and table

Page layout has always been my concern since I st...

JavaScript implements an input box component

This article example shares the specific code for...

Implementation of CSS circular hollowing (coupon background image)

This article mainly introduces CSS circular hollo...

How to build mysql master-slave server on centos7 (graphic tutorial)

This article mainly introduces how to build a MyS...

Use of marker tags in CSS list model

This article mainly introduces the ::master pseud...

Two methods to implement Mysql remote connection configuration

Two methods to implement Mysql remote connection ...