Skip to content

Instantly share code, notes, and snippets.

@Karunamon
Forked from witscher/tomcat.conf
Last active August 29, 2015 14:19
Show Gist options
  • Save Karunamon/a7301539a5962bcfd20b to your computer and use it in GitHub Desktop.
Save Karunamon/a7301539a5962bcfd20b to your computer and use it in GitHub Desktop.
Tomcat upstart script
description "Tomcat Server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
# run as non privileged user
# add user with this command:
## adduser --system --ingroup www-data --home /opt/tomcat tomcat
# Ubuntu 12.04: (use 'exec sudo -u tomcat' when using 10.04)
setuid tomcat
setgid www-data
# adapt paths:
#env JAVA_HOME=/opt/java (Unnecessary given a proper java install)
env CATALINA_HOME=/opt/tomcat
# adapt java options to suit your needs:
#env JAVA_OPTS="-Djava.awt.headless=true -Xms512M -Xmx1024M -server -XX:+UseParallelGC"
exec $CATALINA_HOME/bin/catalina.sh run
# cleanup temp directory after stop
post-stop script
#rm -rf $CATALINA_HOME/temp/* (Temp is often abused, let's not clear it unless necessary)
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment