Home > Operation and Maintenance > Linux Operation and Maintenance > How to set up tomcat to start automatically in linux

How to set up tomcat to start automatically in linux

WBOY
Release: 2023-05-19 23:13:09
forward
3897 people have browsed it

Linux sets tomcat to automatically start under centos, and the commands in /etc/rc.local will be automatically executed after booting.

The usual command to start tomcat is:

tomcat_home/bin/startup.sh或tomcat_home/bin/catalina.sh start
Copy after login

When directly adding any of them to /etc/rc.local, after restarting the machine, it is found that tomcat has not started. The reason is that the java environment has not been set up when booting, so I write a script to set up the java environment first and then start it. The script is as follows:

export java_home=/usr/local/jdk1.6.0_30
export path=$java_home/bin/:$path
export classpath=.:$java_home/lib/dt.jar:$java_home/lib/tools.jar:$classpath
export catalina_home=/usr/local/tomcat-6.0.35/
Copy after login
/usr/local/tomcat-6.0.35/bin/catalina.sh start
Copy after login

Assume that it is saved as a file named auto-startup.sh Store it under /usr/local/tomcat-6.0.35/bin, and then add /usr/local/tomcat-6.0.35/bin/auto-startup.sh to /etc/rc.local. Note: You need to set auto-startup.sh to have execution permissions.

What versions of Linux are there?

Linux versions include: Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and other versions. Among them, Deepin is one of the best-developed Linux distributions in China; Ubuntu Kylin is a derivative distribution based on Ubuntu; Manjaro is a Linux distribution based on Arch; LinuxMint's default Cinnamon desktop is similar to Windows XP and is simple and easy to use; Ubuntu is a desktop application Mainly Linux operating system.

The above is the detailed content of How to set up tomcat to start automatically in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template