Run tomcat command

There are three main ways to start Tomcat in Linux

#The first way is to start directly
# ./startup.sh

#Second, console dynamic input
# ./catalina.sh run

#The third way is to start as a service
# nohup ./startup.sh &
Copy the code

Sh start. As with./catalina.sh run, the Tomcat service is terminated when the client is disconnected.

The benefit of the second approach is that you can dynamically display the output of the Tomcat console, including log4J and SYSOUT information. Using this method, you can easily check the status of the application when it is up and running, without having to open the Catalina. out file every time.

The third way is to use the nohup command to start the Tomcat service on the background. The full English name of nohup is no hang up. Nohup is used to run commands on the background without hanging up.

The nohup command, by default (when not redirected), outputs a file named nohup. Out to the current directory. If the nohup.

Other common commands

#Disabling the Tomcat Service
# ./shutdown.sh

#Debugging tomcat
# ./catalina.sh debug

#Viewing the Tomcat Process
# ps -ef | grep tomcat

#See the log
# tail -f catalina.out

#Clear the log
# echo -n ' ' catalina.out

#Checking tomcat Status
# systemctl status tomcat

#Start Tomcat
# systemctl start tomcat

#Shut down the boot and start Tomcat
# systemctl stop tomcat

#Restart the tomcat
# systemctl restart tomcat
Copy the code

Systemctl is the main command of systemd and is used to manage the system.