To answer my own question; I did some google searching and figured out that you 
need to copy the tomcat conf directory to ~tomcat and also create the 
directories ~/tomcat/logs, ~/tomcat/temp, and ~/tomcat/work; all owned by 
tomcat.  Then copy over the webapps directory, or make a new one in ~tomcat and 
copy over the wars.

So my ~tomcat looks like the following:

r...@test1:/home/tomcat# ls -l
total 20
drwxr-xr-x 2 tomcat tomcat 4096 2009-01-23 11:41 conf/
drwxr-xr-x 2 tomcat tomcat 4096 2009-01-23 11:41 logs/
drwxr-xr-x 2 tomcat tomcat 4096 2009-01-23 11:42 temp/
drwxrwxr-x 8 rusty  tomcat 4096 2009-01-23 11:42 webapps/
drwxr-xr-x 3 tomcat tomcat 4096 2009-01-23 11:41 work/

r...@wss-test1:/home/tomcat# ls -l conf
total 92
-rw-r--r-- 1 tomcat tomcat  8690 2008-07-21 17:01 catalina.policy
-rw-r--r-- 1 tomcat tomcat  3665 2008-07-21 17:01 catalina.properties
-rw-r--r-- 1 tomcat tomcat  1395 2008-11-19 14:22 context.xml
-rw-r--r-- 1 tomcat tomcat  3664 2008-07-21 17:01 logging.properties
-rw-r--r-- 1 tomcat tomcat  6460 2008-07-21 17:01 server.xml
-rw-r--r-- 1 tomcat tomcat   165 2009-01-23 11:41 tomcat-users.xml
-rw-r--r-- 1 tomcat tomcat 50105 2008-11-19 14:23 web.xml

I love shell script hacks so my /etc/init.d/tomcat script has the following in 
the upper part where it's setting variables:

TOMCAT_HOME=`grep ^tomcat /etc/passwd | sed -e 's/.*:.*:.*:.*:.*:\(.*\):.*/\1/'`

export CATALINA_BASE=${TOMCAT_HOME}

Perhaps instead of .* I could have used [^:]*

Rusty Wright wrote:
Thanks, I like that suggestion.

So, to use your method, using the su below, would I do

 export CATALINA_BASE=/home/tomcat
 su - tomcat -c /path/to/tomcat/bin/startup.sh

Do I need to copy anything from the original tomcat directory to /home/tomcat, or do I need to make any directories in it? Or is it simply a replacement for the tomcat/webapps directory?


Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rusty,

Rusty Wright wrote:
It's set up so that tomcat runs as the user tomcat.  In order to do that
you'll need to tweak the ownership of the files in the tomcat
directory.

I would recommend that, instead of modifying the ownership of the Tomcat
installation directory, you instead use CATALINA_BASE set to somewhere
that has appropriate permissions for the user in question. Something
like /home/tomcat.

This also allows you to upgrade Tomcat much more easily just by
adjusting the path to startup.bat and bouncing Tomcat.

If the OP is using this script as part of the system startup (that is,
it is running as root), then you'll need to adjust the startup command
to be:

su - tomcat -c /path/to/tomcat/bin/startup.sh

This will switch to the tomcat user before launching Tomcat.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkl6EF8ACgkQ9CaO5/Lv0PDolACgwG/Rx+cpzb8GuX4BOzjEhakU
Yq8An05jNk9mz17qCMpo44i1NfrIUDX2
=1D1X
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to