Bug 64430 - rotating catalina.out (using named pipe)
Summary: rotating catalina.out (using named pipe)
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.5.54
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2020-05-13 14:30 UTC by harald.dunkel
Modified: 2020-05-28 21:11 UTC (History)
0 users

patch for catalina.sh (1.63 KB, patch)
2020-05-13 14:30 UTC, harald.dunkel
Details | Diff
better patch (1.67 KB, patch)
2020-05-13 14:41 UTC, harald.dunkel
Details | Diff
even better patch (1.53 KB, patch)
2020-05-14 05:55 UTC, harald.dunkel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description harald.dunkel 2020-05-13 14:30:12 UTC
Created attachment 37239 [details]
patch for catalina.sh

AFAICS the code in catalina.sh to rotate catalina.out has been withdrawn with 5.8.39. #53930

Changing the system's logrotate.conf to rotate catalina.out requires root permission. This might be not an option in some cases. 

I would like to suggest a new approach to rotate catalina.out. See attached patch. The idea is to define CATALINA_OUT_CMD (as for 8.5.38), but this time catalina.sh creates a named pipe on the fly, to be used instead of a plain file "catalina.sh". The code about catalina's PID is not changed, i.e. the systemd users should be happy with the new version.

The default behavior of catalina.sh hasn't been changed (hopefully). 

Just a suggestion, of course. Keep on your good work
Comment 1 harald.dunkel 2020-05-13 14:41:12 UTC
Created attachment 37240 [details]
better patch
Comment 2 harald.dunkel 2020-05-13 14:42:51 UTC
Please ignore the first patch. I picked the right file from the wrong directory.
Comment 3 Michael Osipov 2020-05-13 19:27:16 UTC
The shell script has to be portable, "mknod -p" is not portable. This will require cases for various Unix systems. What about fifo with mkfifo?
Comment 4 harald.dunkel 2020-05-14 05:55:24 UTC
Created attachment 37242 [details]
even better patch

Good suggestion. I highly appreciate your effort to keep portability.

Attached is a new patch, using mkfifo. The comment about CATALINA_OUT_CMD and the indentation style have been adjusted, too.
Comment 5 Mark Thomas 2020-05-28 14:50:24 UTC
I like the modified approach. I'll run some tests locally and if all is well, I'll apply this for the next release round.
Comment 6 Mark Thomas 2020-05-28 21:11:10 UTC
Thanks for the patch.

Fixed in:
- master for 10.0.0-M6 onwards
- 9.0.x for 9.0.36 onwards
- 8.5.x for 8.5.56 onwards
- 7.0.x for 7.0.105 onwards