Thursday, September 1, 2016

How to Speed Up the Alfresco Shutdown Script on Linux

If you are running Alfresco One on a Linux platform with the bundled Tomcat configuration and you are frequently experiencing a slower-than-expected shut down of the Tomcat process, here’s a tip to configure Alfresco to force the Tomcat process to shut down more quickly.

When you use the ‘ stop’ or ‘ stop tomcat’ command, the tomcat/scripts/ script is called to shut down the Tomcat process. The ‘stop_tomcat()’ subroutine in this script, in turn, calls the Tomcat script and passes in two arguments (‘300’ and ‘-force’) in the following section of the script:

 stop_tomcat() {
    if [ $RUNNING -eq 0 ]; then
        echo "$0 $ARG: $TOMCAT_STATUS"
        if [ $TOMCAT_ASTOMCATUSER -eq 1 ]; then
            $TOMCAT_BINDIR/ stop
            $TOMCAT_BINDIR/ 300 -force
This instructs the Tomcat shutdown script to wait (or sleep) up to 300 seconds before using the ‘kill’ command to force kill the process if it is still running. If your Tomcat shutdown process is making its way into this section of script – for whatever reason, and you are not willing to wait up to 5 minutes for the process to be killed, you can reduce the ‘sleep’ argument (i.e., 300) in the tomcat/scripts/ script to a more tolerable amount of time (e.g., 30 or 60 seconds). Although you may not want to do this in your production Alfresco installation, consider using this tip in your test/development installation if the Tomcat shutdown time becomes an issue for you.

No comments:

Post a Comment