Hi,
I have s strange problem starting a tomcat server on Ubuntu
In my playbook:
- name: Start tomcat
action: service name=apache-tomcat-6.0.35-01 state=started
or
- name: Start tomcat
action: shell service apache-tomcat-6.0.35-01 start
or
- name: Start tomcat
action: shell /etc/init.d/apache-tomcat-6.0.35-01 start
or
- name: Start tomcat
action: raw /etc/init.d/apache-tomcat-6.0.35-01 start
but:
- name: Start tomcat
action: shell /etc/init.d/apache-tomcat-6.0.35-01 start; sleep 60
Yes, indeed it starts the server but when the playbook is finished, the daemon stops also
The daemon looks like this:
cat /etc/init.d/apache-tomcat-6.0.35-01
#!/bin/sh
Variabelen die je niet mag aanpassen!!!
VERSION=apache-tomcat-6.0.35-01
USER=tomcat
GROUP=tomcat
CATALINA_HOME=/opt/tomcat/$VERSION
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
TOMCAT6_SECURITY=no
CATALINA_PID=/var/run/tomcat/${VERSION}.pid
CATALINA_START=“$CATALINA_HOME/bin/startup.sh”
CATALINA_STOP=“$CATALINA_HOME/bin/shutdown.sh”
export CATALINA_HOME JAVA_HOME TOMCAT6_SECURITY CATALINA_PID
Variabelen die je eventueel kunt aanpassen
-Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true : Tomcat has a memory leak where large JSP page requests can fill up memory
Currently Tomcat re-use their output buffers (ostensibly for performance), but if you serve a large amount of HTML (say 10MB) the buffers sit around forever, and don’t get cleaned up
JAVA_OPTS=“-server -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true”
MEM_PARAMS=“-Xms1024m -Xmx1024m -XX:MaxPermSize=256m -XX:PermSize=256m”
LOCAL_OPTS=“-Djava.awt.headless=true -Duser.language=nl -Duser.country=BE -Dlogging.dir=$CATALINA_HOME/logs”
Indien je een proxy nodig hebt.
JAVA_OPTS=“$JAVA_OPTS -Dhttp.proxyHost=forward-proxy-#VLAN#.mmis.be -Dhttp.proxyPort=3128 -Dhttp.nonProxyHosts=*.mmis.be|localhost”
LOCAL_OPTS=“-Djava.awt.headless=true -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9004 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Duser.language=nl -Duser.country=BE -Dlogging.dir=$CATALINA_HOME/logs”
Indien nodig kan je zelf bijkomende environment variabelen plaatsen in:
$CATALINA_HOME/bin/setenv.sh
Zet de rechten goed: chmod 755 $CATALINA_HOME/bin/setenv.sh
. /lib/lsb/init-functions
if [ ! -d /var/run/tomcat ]; then
mkdir -p /var/run/tomcat
chown $USER:$GROUP /var/run/tomcat
fi
case $1 in
‘start’)
JAVA_OPTS=“$JAVA_OPTS $MEM_PARAMS $LOCAL_OPTS”; export JAVA_OPTS
touch $CATALINA_PID
chown $USER:$GROUP $CATALINA_PID
/sbin/start-stop-daemon -S -u $USER -g $GROUP -c $USER -x $CATALINA_START
;;
‘stop’)
JAVA_OPTS=“-Dlogging.dir=$CATALINA_HOME/logs”; export JAVA_OPTS
Indien je -u $USER meegeeft dan gaat hij ook andere tomcat daemons stoppen
/sbin/start-stop-daemon -K -p $CATALINA_PID -R TERM/20/KILL/5
rm -f $CATALINA_PID
;;
‘restart’)
$0 stop
sleep 10
$0 start
;;
*)
echo “Usage: $0 { start | stop | restart }”
exit 1
;;
esac
exit 0
No problem when starting the deamon on the server.
Any ideas?
Regards,
Gerrit