Setting up Tomcat to shutdown and startup automatically when the Linux / Unix server restarts. The following is for Fedora Linux, with Tomcat installed at /usr/local/tomcat (probably via a symlink as taught on
our deployment course). Server configuration - assuming a default run state of 3.
1. Copy catalina.sh to /etc/init.d/tomcatrun
2. Add the following after the #! line but before any executable code
CATALINA_HOME=/usr/local/tomcat
export CATALINA_HOME
PATH=/usr/local/java/bin:$PATH
export PATH
JAVA_HOME=/usr/local/java
export JAVA_HOME
3. Add the following symlinks in the /etc/rc3.d directory
lrwxrwxrwx 1 root root 19 Feb 23 10:37 K04tomcat -> ../init.d/tomcatrun
lrwxrwxrwx 1 root root 19 Feb 23 10:37 S98tomcat -> ../init.d/tomcatrun
Let me stress - this is an
example - you may have differences depending on the OS flavour, default run state, install directory for Tomcat, and other daemons that you are starting.
(written 2008-02-24)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
A164 - Web Application Deployment - Services and Regular Jobs [3792] Managing daemons from a terminal session - (2012-07-01)
[3791] The Kernel, Shells and Daemons. Greek Gods in computing - (2012-07-01)
[3143] On time - (2011-01-23)
[3011] What are .pid files? - (2010-10-23)
[2182] What Linux run level am I in? - (2009-05-15)
[2145] Using the internet to remotely check for power failure at home (PHP) - (2009-04-29)
[1903] daemons - what is running on my Linux server? - (2008-11-23)
[1765] Dialects of English and Unix - (2008-08-21)
[1733] memcached - overview, installation, example of use in PHP - (2008-08-02)
[1731] Apache httpd, MySQL, PHP - installation procedure - (2008-08-01)
[1700] FTP server on Fedora Linux - (2008-07-06)
[1633] Changing a screen saver from a web page (PHP, Perl, OSX) - (2008-05-06)
[1288] Linux run states, shell special commands, and directory structures - (2007-08-03)
[1028] Linux / Unix - process priority and nice - (2007-01-10)
[907] Browser -> httpd -> Tomcat -> MySQL. Restarting. - (2006-10-28)
[544] Repeating tasks with crontab - (2005-12-27)
A654 - Web Application Deployment - Configuring and Controlling Tomcat [3043] Gathering information - logging - with log4j. First steps. - (2010-11-12)
[2652] Reading and writing cookies in Java Servlets and JSPs - (2010-02-26)
[2163] CATALINA_OPTS v JAVA_OPTS - What is the difference? - (2009-05-09)
[2061] Tomcat 6 - Annotated Sample Configuration Files - (2009-03-01)
[2039] The Invoker - (2009-02-13)
[1994] tomcat-users.xml; what a difference a space made - (2009-01-16)
[1943] Port and Glasses - (2008-12-14)
[1762] WEB-INF (Tomcat) and .htaccess (httpd) - (2008-08-20)
[1503] Web page (http) error status 405 - (2008-01-12)
[1370] Apache Tomcat Performance Tuning - (2007-09-29)
[1351] Compressing web pages sent out from server. Is it worth it? - (2007-09-14)
[914] A practical example of roles - (2006-11-04)
[837] Tomcat - Shutdown port - (2006-08-18)
3ef5
Some other Articles
Trying out our Java examples on our web siteJava - a demonstration of inheritance on just one pageAdvanced Python, Perl, PHP and Tcl training courses / classesOnline hotel reservations - Melksham, Wiltshire (near Bath)Automatic startup and shutdown of TomcatExtra public classes in deploying Apache httpd and TomcatWhich modules are loaded in my Apache httpdJava (JSP and Servlet examples) live on our serverhttp, https and ajp - comparison and choiceHotelympia - show report - the lighter side