Skip to content

Instantly share code, notes, and snippets.

@bryanwb
Last active December 15, 2015 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanwb/5220818 to your computer and use it in GitHub Desktop.
Save bryanwb/5220818 to your computer and use it in GitHub Desktop.
description "Tomcat Server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
#kill timeout 10 # this causes stop to fail
# run as non privileged user
# add user with this command:
## adduser --system --ingroup www-data --home /opt/apache-tomcat apache-tomcat
# Ubuntu 12.04: (use 'exec sudo -u apache-tomcat' when using 10.04)
setuid tomcat
setgid tomcat
expect fork
# adapt paths:
env JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
env CATALINA_HOME=/usr/local/tomcat
# adapt java options to suit your needs:
env JAVA_OPTS="-Djava.awt.headless=true -Xms512M -Xmx1024M -server -XX:+UseParallelGC -Djava.net.preferIPv4Stack=true"
exec $CATALINA_HOME/bin/catalina.sh run
# cleanup temp directory after stop
post-stop script
rm -rf $CATALINA_HOME/temp/*
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment