Created
March 22, 2013 13:15
-
-
Save bryanwb/5221163 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/init/test_app.conf | |
# Task to automatically start the test application service for demo | |
# dependant on mysql service | |
author "Darren Watt" | |
description "Test App" | |
expect fork | |
start on started mysql | |
stop on stopping mysql | |
env CATALINA_HOME=/home/user/test_app | |
env JAVA_HOME=/usr/bin/java | |
env USER=demo | |
description "Tomcat Server" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
respawn limit 10 5 | |
expect fork | |
# adapt paths: | |
env JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 | |
env CATALINA_HOME=/usr/local/tomcat | |
env CATALINA_OUT=/usr/local/tomcat/logs/catalina.out | |
env USER=tomcat | |
# adapt java options to suit your needs: | |
env JAVA_OPTS="-Djava.awt.headless=true -Xms512M -Xmx1024M -server -XX:+UseParallelGC -Djava.net.preferIPv4Stack=true" | |
script | |
cd $ROOT_DIR | |
exec su -c "$JAVA_HOME/bin/java $JAVA_OPTS " $USER > $CATALINA_OUT 2>&1 | |
end script | |
# 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