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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBforward
2023-05-19 23:13:093939browse

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

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/
/usr/local/tomcat-6.0.35/bin/catalina.sh start

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!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete