/
How to run Tomcat using PID on Linux?
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

How to run Tomcat using PID on Linux?

Often when shutting down Tomcat, it does not shutdown gracefully and have to result in using the "kill -9" command. Using kill is not a good practice since it is not let the application do the cleanup during the shutdown process and can have undesirable side effects.

To avoid this, on Linux, there is an option to use PID during startup and shutdown. To use the same, follow the below steps:

  1. Create a file setenv.sh in $TOMCAT_DIR/bin folder
  2. Edit this file and set the variable CATALINA_PID with the pid.txt file path.

    Example
    CATALINA_PID=$TOMCAT_DIR/bin/pid.txt
  3. When using shutdown.sh, use the option -force

    Example
    shutdown.sh -force

Related content

Create Tomcat service manually
Create Tomcat service manually
More like this
How to fix "out of memory" error ?
How to fix "out of memory" error ?
More like this
Deployment steps
Deployment steps
More like this
Error :Caused by: java.sql.SQLException: ORA-28001: the password has expired
Error :Caused by: java.sql.SQLException: ORA-28001: the password has expired
Read with this
How to run Tomcat as a service
How to run Tomcat as a service
More like this
How to upgrade Tomcat?
How to upgrade Tomcat?
More like this
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com