Last active
July 11, 2016 21:05
-
-
Save ColinMaudry/dd894c935d7b784aca34 to your computer and use it in GitHub Desktop.
Upstart service configuration for Tomcat
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
description "Tomcat 7 service" | |
#So that you remember what the services does | |
start on runlevel [2345] | |
# When the service should start. 2, 3, 4 and 5 are | |
# runlevels that are various flavours of system startup. | |
stop on runlevel [06] | |
# 0 is for system halt and 6 is for system reboot | |
respawn | |
# If the service is stopped otherwise than with a proper 'stop' | |
# message (system halt or reboot), the service will restart automatically | |
respawn limit 3 10 | |
# In case the service cannot boot properly (e.g. misconfiguration), | |
# this prevents the service to go crazy an reboot endlessly. | |
# 3 10 means "don't respawn more than 3 times in 10 seconds" | |
pre-start exec /home/admin/init_casanovald.sh | |
# pre-start, post-start and pre-stop enable you | |
# to run stuff before or after starting a service | |
exec /var/lib/tomcat7/bin/catalina.sh run >> "/var/lib/tomcat7/logs/catalina.out" 2>&1 | |
# This is where the service actually gets started. If you don't | |
# redirect the messages, they end in /var/log/syslog. |
@gustavofcalmeida - I had the same thought, until I realised we are using run
target, instead of start
; therefore tomcat is running in the process kicked off by this script - not in the background. When you call service tomcat7 stop, the run
process is terminated, and therefore the tomcat instance is terminated.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why don't you ever call the shutdown.sh script?
If I try to stop Tomcat via upstart how will it know what to do?