tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: New jsvc (commons-daemon-native); catalina.out is owned by root - WTF?
Date Wed, 01 Dec 2010 17:14:24 GMT
Gregor Schneider wrote:
> Hi André,
> long time no see ;)
> On Wed, Dec 1, 2010 at 12:20 PM, André Warnier <> wrote:
>> As far as I know, these startup scripts are created by the packagers of
>> Debian, RedHat etc.. when they wrap Tomcat in a platform-specific package.
>> /They/ are the ones who decide how they call up jsvc, where the logfiles go,
>> under what permissions etc..
> That's actually not the case:
> The startaup-script for Tomcat native comes with the jscv-sources,
> meaning it's *not* some pre-packaged Debian-thing.

Ok, I did not know that, because (should I admit this here?) I /do/ use the pre-packaged 

And these pre-packaged things (sometimes) use another trick :

	rm -rf "$CATALINA_BASE/logs/catalina.out"
	mkfifo -m700 "$CATALINA_BASE/logs/catalina.out"

	su -p -s /bin/sh $TOMCAT5_USER \
		-c "$ROTATELOGS \"$CATALINA_BASE/logs/catalina_%F.log\" 86400" \
		< "$CATALINA_BASE/logs/catalina.out" &

	su -p -s /bin/sh $TOMCAT5_USER \
		-c "\"$DAEMON\" start $STARTUP_OPTS" \
		>> "$CATALINA_BASE/logs/catalina.out" 2>&1

So they start by making catalina.out a fifo (a named pipe ?), then arrange for rotatelogs

(from Apache httpd) to read from it and rotate it, then they have Tomcat write to it.

If you arrange for the last su to run jsvc instead of Tomcat directly, then it achieves 
the same purpose as your trick.  A bit more complex, but it does have rotation by 
rotatelogs extra, with lots of options.

(Other versions direct this to SYSLOG).

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message