How to set tomcat startup in linux

2023-12-19 14:54:36

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

The command to start tomcat at ordinary times is:

Tomcat_home/bin/startup.sh or Tomcat _ home/bin/catalina.sh start

When you directly add any of them to /etc/rc.local, you will find that tomcat is not started after restarting the machine. The reason is that the java environment has not been set up at startup, so I write a script myself, first set the java environment, and then start it. The script is as follows:

export java_home=/usr/local/jdk1.6.0_30export path=$java_home/bin/:$pathexport classpath=.:$java_home/lib/dt.jar:$java_home/lib/tools.jar:$classpathexport catalina_home=/usr/local/tomcat-6.0.35/

/usr/local/tomcat-6.0.35/bin/catalina.sh start

Suppose you save it as a file named auto-startup.sh and store it under /usr/local/tomcat-6.0.35/bin, and then add/usr/local/Tomcat-6.0.35/bin/auto-startup.sh in/etc/rc.local. Note: you need to set auto-startup.sh to have execution permission.

What versions of Linux are there? The versions of Linux are Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and so on. Deepin is one of the best developed Linux distributions in China. UbuntuKylin 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 easy to use. Ubuntu is a Linux operating system based on desktop applications.


Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us