0

I have an upstart script that is used to start apache tomcat on an RHEL 6.8 system. The upstart script is as follows

start on runlevel [2345]
stop on runlevel [!2345]
respawn
    exec >/root/Desktop/test.debug 2>&1
    exec su -s opt/apache-tomcat/bin/startup.sh tomcat

Apache tomcat starts but when it forks or something in the startup.sh script upstart think the process has died and keeps trying to respawn until the respawn limit is hit.

Is there anyway in the upstart script to make sure it will track the correct tomcat PID?

jgr208
  • 2,896
  • 9
  • 36
  • 64

1 Answers1

0

I have found the correct way to start tomcat and keep track of the PID. You don't want to use startup.sh but instead catalina.sh and have the following in the upstart script.

start on runlevel [2345]
stop on runlevel [!2345]
respawn
env CATALINA_HOME=/opt/apache-tomcat
#exec sudo -u tomcat
script
    exec >/root/Desktop/test.debug 2>&1
    exec su -s /bin/bash -c "$CATALINA_HOME/bin/catalina.sh run" tomcat
end script
jgr208
  • 2,896
  • 9
  • 36
  • 64