commit:     4b7d40cb0dd5213674766c48193efba1da74edff
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 22 17:22:26 2020 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Wed Jan 22 22:51:43 2020 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=4b7d40cb

src/php-fpm.logrotate.in: add a logrotate script for php-fpm.

Since all of the log files for php-fpm wind up in the same place
regardless of slot, we install a single logrotate file as part of
eselect-php. The contents of the file may not be perfect -- they were
taken from the example submitted on bug 692194 untested -- but will be
easy to update in the future.

Bug: https://bugs.gentoo.org/692194
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .gitignore               | 1 +
 Makefile.am              | 9 +++++++--
 src/php-fpm.logrotate.in | 7 +++++++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 9bfa566..420a5c3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ openrc/init.d/php-fpm.in
 src/php.eselect
 src/php.eselect.in
 src/php-fpm-launcher
+src/php-fpm.logrotate

diff --git a/Makefile.am b/Makefile.am
index f544739..e425c84 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,8 @@ nodist_eselect_DATA = $(srcdir)/src/php.eselect
 # Without EXTRA_DIST, these files don't wind up in the tarball.
 EXTRA_DIST = $(srcdir)/openrc \
              $(srcdir)/src/70_mod_php.conf.in \
-             $(srcdir)/src/php-fpm-launcher.in
+             $(srcdir)/src/php-fpm-launcher.in \
+             $(srcdir)/src/php-fpm.logrotate.in
 
 if APACHE2
   # Without these set, we won't try to install the conf file.
@@ -22,6 +23,9 @@ if FPM
 
   nodist_libexec_SCRIPTS = $(srcdir)/src/php-fpm-launcher
 
+  logrotatedir = $(sysconfdir)/logrotate.d
+  nodist_logrotate_DATA = $(srcdir)/src/php-fpm.logrotate
+
   tmpfilesdir = $(prefix)/lib/tmpfiles.d
   dist_tmpfiles_DATA = $(srcdir)/src/php-fpm.conf
 endif
@@ -37,7 +41,7 @@ edit = sed -e 's|@BINDIR[@]|$(bindir)|g' \
            -e 's|@SYSCONFDIR[@]|$(sysconfdir)|g'
 
 
-$(nodist_eselect_DATA) $(nodist_apacheconf_DATA) $(nodist_init_SCRIPTS) 
$(nodist_libexec_SCRIPTS): Makefile
+$(nodist_eselect_DATA) $(nodist_apacheconf_DATA) $(nodist_init_SCRIPTS) 
$(nodist_libexec_SCRIPTS) $(nodist_logrotate_DATA): Makefile
        rm -f $@ $@.tmp
        srcdir=''; \
          test -f ./$@.in || srcdir=$(srcdir)/; \
@@ -46,5 +50,6 @@ $(nodist_eselect_DATA) $(nodist_apacheconf_DATA) 
$(nodist_init_SCRIPTS) $(nodist
 
 $(srcdir)/src/php.eselect: $(srcdir)/src/php.eselect.in
 $(srcdir)/src/php-fpm-launcher: $(srcdir)/src/php-fpm-launcher.in
+$(srcdir)/src/php-fpm.logrotate: $(srcdir)/src/php-fpm.logrotate.in
 $(srcdir)/src/70_mod_php.conf: $(srcdir)/src/70_mod_php.conf.in
 $(srcdir)/openrc/init.d/php-fpm: $(srcdir)/openrc/init.d/php-fpm.in

diff --git a/src/php-fpm.logrotate.in b/src/php-fpm.logrotate.in
new file mode 100644
index 0000000..5847fdc
--- /dev/null
+++ b/src/php-fpm.logrotate.in
@@ -0,0 +1,7 @@
+@LOCALSTATEDIR@/log/php-fpm.log @LOCALSTATEDIR@/log/php-fpm-*.log.slow {
+  create 600 root root
+  size 5M
+  copytruncate
+  notifempty
+  missingok
+}

Reply via email to