You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Josh Gooding <jo...@gmail.com> on 2012/11/18 05:37:16 UTC

Re: Delete catalina.out

Chris,

Moved this to the user list instead of the dev group.  Hmmm strangely
enough, I tried this on a CentOS system, I believe it forced me to be root
over the tomcat user. I can re-check that shortly.  I know it recreates the
file <catalina.out> next time without any discourse, if I run the startup
script as the tomcat user.

:: update :: I figured out WHY it forced me to be root.  Someone *(may or
may not have been me) ran the /etc/init.d/tomcat start script as the root
user, not as the tomcat user which I believe would cause this behavior.

- Josh

On Sat, Nov 17, 2012 at 8:13 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> Josh,
>
> On 11/15/12 2:45 PM, Josh Gooding wrote:
> > That is the tomcat default log file.  Nothing server wise will happen if
> > you delete if that is your concern.  It just removes that particular log
> > file.  I believe that you have to either be root and/or have the server
> > stopped to remove the file however.
>
> On a *NIX system, neither of the above statements are true: you may
> delete the file while a process holds a file handle to the file (the
> file will no longer be accessible to any other process -- at least under
> its old name) without harm.
>
> I'm not sure what will happen on win32. You'll either fail to delete the
> file or get the *NIX-style behavior.
>
> Once deleted, the file will be re-created when Tomcat next launches, as
> long as the Tomcat process has "create" privileges for the
> CATALINA_BASE/logs directory.
>
> -chris
>
>

Re: Delete catalina.out

Posted by Josh Gooding <jo...@gmail.com>.
Chris,

Yes I certainly agree with that.  The init.d script should sudo -u tomcat
the catalina.sh script.  I believe that I have fixed all of them to
correctly run as the tomcat user.

- Josh

On Mon, Nov 19, 2012 at 3:43 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Josh,
>
> On 11/17/12 11:37 PM, Josh Gooding wrote:
> > Moved this to the user list instead of the dev group.  Hmmm
> > strangely enough, I tried this on a CentOS system, I believe it
> > forced me to be root over the tomcat user.
>
> It all depends upon the file permissions of catalina.out and the
> directory in which it resides. Deleting catalina.out certainly does
> not require root access in all cases, but I'm sure there are cases
> where root is required (e.g. because you are running Tomcat as root).
>
> > I can re-check that shortly.  I know it recreates the file
> > <catalina.out> next time without any discourse, if I run the
> > startup script as the tomcat user.
> >
> > :: update :: I figured out WHY it forced me to be root.  Someone
> > *(may or may not have been me) ran the /etc/init.d/tomcat start
> > script as the root user, not as the tomcat user which I believe
> > would cause this behavior.
>
> You should write your /etc/init.d scripts in such a way that they run
> under the proper user no matter who invokes them. For instance, if you
> want to run Tomcat as 'tomcat' then your init.d script should probably
> do "sudo -u tomcat $CATALINA_BASE/bin/catalina.sh start" or something
> to that effect.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with undefined - http://www.enigmail.net/
>
> iEYEARECAAYFAlCqmfEACgkQ9CaO5/Lv0PD8BgCgrexYyS13j84h9SJx4S2/eZl1
> ZYUAn0N5SEsmWRJSuO8ezspEbYDl5+f0
> =7zTN
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Delete catalina.out

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Josh,

On 11/17/12 11:37 PM, Josh Gooding wrote:
> Moved this to the user list instead of the dev group.  Hmmm
> strangely enough, I tried this on a CentOS system, I believe it
> forced me to be root over the tomcat user.

It all depends upon the file permissions of catalina.out and the
directory in which it resides. Deleting catalina.out certainly does
not require root access in all cases, but I'm sure there are cases
where root is required (e.g. because you are running Tomcat as root).

> I can re-check that shortly.  I know it recreates the file
> <catalina.out> next time without any discourse, if I run the
> startup script as the tomcat user.
> 
> :: update :: I figured out WHY it forced me to be root.  Someone
> *(may or may not have been me) ran the /etc/init.d/tomcat start
> script as the root user, not as the tomcat user which I believe
> would cause this behavior.

You should write your /etc/init.d scripts in such a way that they run
under the proper user no matter who invokes them. For instance, if you
want to run Tomcat as 'tomcat' then your init.d script should probably
do "sudo -u tomcat $CATALINA_BASE/bin/catalina.sh start" or something
to that effect.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlCqmfEACgkQ9CaO5/Lv0PD8BgCgrexYyS13j84h9SJx4S2/eZl1
ZYUAn0N5SEsmWRJSuO8ezspEbYDl5+f0
=7zTN
-----END PGP SIGNATURE-----

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