Command Line Option to Display and Prevent Duplicate PID Instances from Starting

XMLWordPrintable

      Currently, in Crowd, if we attempt to start an instance while it's already running, it throws a message on the terminal providing the PID of the active instance, preventing the initiation of a second process.

      It would be helpful if Bamboo could have such settings to prevent starting it twice.

      ~/Downloads/atlassian-crowd-5.3.1 » ./start_crowd.sh                                                                                             gferreira@C71N9TM697
      To run Crowd in the foreground, start the server with ./start_crowd.sh -fg
      Using CATALINA_BASE:   /Users/gferreira/Downloads/atlassian-crowd-5.3.1/apache-tomcat
      Using CATALINA_HOME:   /Users/gferreira/Downloads/atlassian-crowd-5.3.1/apache-tomcat
      Using CATALINA_TMPDIR: /Users/gferreira/Downloads/atlassian-crowd-5.3.1/apache-tomcat/temp
      Using JRE_HOME:        /opt/homebrew/Cellar/openjdk@11/11.0.23/
      Using CLASSPATH:       /Users/gferreira/Downloads/atlassian-crowd-5.3.1/apache-tomcat/bin/bootstrap.jar:/Users/gferreira/Downloads/atlassian-crowd-5.3.1/apache-tomcat/bin/tomcat-juli.jar
      Using CATALINA_OPTS:
      Using CATALINA_PID:    /Users/gferreira/Downloads/atlassian-crowd-5.3.1/apache-tomcat/work/catalina.pid
      Existing PID file found during start.
      Tomcat appears to still be running with PID 13685. Start aborted.
      If the following process is not a Tomcat process, remove the PID file and try again:
        UID   PID  PPID   C STIME   TTY           TIME CMD
        501 13685     1   0  4:20   ttys001    0:07.31 /opt/homebrew/Cellar/openjdk@11/11.0.23//bin/java -Djava.util.logging.config.file=/Users/gferreira/Downloads/atlassian-crowd-5.3.1/apache-tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms128m -Xmx512m -Dfile.encoding=UTF-8 -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -classpath /Users/gferreira/Downloads/atlassian-crowd-5.3.1/apache-tomcat/bin/bootstrap.jar:/Users/gferreira/Downloads/atlassian-crowd-5.3.1/apache-tomcat/bin/tomcat-juli.jar -Dcatalina.base=/Users/gferreira/Downloads/atlassian-crowd-5.3.1/apache-tomcat -Dcatalina.home=/Users/gferreira/Downloads/atlassian-crowd-5.3.1/apache-tomcat -Djava.io.tmpdir=/Users/gferreira/Downloads/atlassian-crowd-5.3.1/apache-tomcat/temp org.apache.catalina.startup.Bootstrap start
      

      Workaround

      1. Edit <bamboo-install>/bin/setenv.sh and add the following lines at the end of the file:
        #
        # Sets the location of the CATALINA_PID file. This prevents duplicate instances from being launched by catalina.sh
        #
        if [ -z "$CATALINA_PID" ] ; then
            if [ -n "$CATALINA_BASE" ] ; then
                CATALINA_PID="$CATALINA_BASE"/work/catalina.pid
            elif [ -n "$CATALINA_HOME" ] ; then
                CATALINA_PID="$CATALINA_HOME"/work/catalina.pid
            fi
        fi
        export CATALINA_PID
        
      2. Restart Bamboo
      3. A catalina.pid should be available on <bamboo-install>/work

            Assignee:
            Eduardo Alvarenga (Inactive)
            Reporter:
            Giovanna Fragoso
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: