From 77b08748cd056c9e6950d7a27016164c8a5671d5 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 17 Jan 2019 18:05:48 +0100 Subject: provide logrotate configuration --- unit.logrotate | 8 ++++++++ unit.spec | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 unit.logrotate diff --git a/unit.logrotate b/unit.logrotate new file mode 100644 index 0000000..a8340a9 --- /dev/null +++ b/unit.logrotate @@ -0,0 +1,8 @@ +/var/log/unit/*.log { + missingok + nocreate + notifempty + postrotate + /bin/kill -SIGUSR1 `cat /var/run/unit/unit.pid` + endscript +} diff --git a/unit.spec b/unit.spec index 2eb8f84..4dc7c51 100644 --- a/unit.spec +++ b/unit.spec @@ -19,7 +19,7 @@ Name: unit Summary: NGINX Unit application server Version: 1.7 -Release: 1%{?dist} +Release: 2%{?dist} License: ASL 2.0 URL: https://unit.nginx.org/ @@ -27,6 +27,7 @@ Source0: https://github.com/%{gh_owner}/%{project}/archive/%{gh_commit Source1: unit.service Source2: unit.init Source3: unit.sysconf +Source4: unit.logrotate # Use system crypto policy Patch0: https://github.com/nginx/unit/pull/215.patch @@ -44,6 +45,8 @@ Requires(preun): chkconfig Requires(preun): initscripts Requires(postun): initscripts %endif +Requires: logrotate + Provides: nginx-unit = %{version}-%{release} @@ -116,6 +119,8 @@ mkdir -p %{buildroot}%{_sharedstatedir}/%{name} mkdir -p %{buildroot}%{_localstatedir}/log/%{name} mkdir -p %{buildroot}%{_localstatedir}/run/%{name} +install -p -D -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} + # init scripts %if %{use_systemd} install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service @@ -173,6 +178,7 @@ fi %dir %{_libdir}/unit/debug-modules %dir %{_sharedstatedir}/unit %dir %attr(0700,root,root) %{_localstatedir}/log/unit +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %if %{use_systemd} %dir %{_sysconfdir}/systemd/system/%{name}.service.d @@ -193,6 +199,9 @@ fi %changelog +* Thu Jan 17 2019 Remi Collet - 1.7-2 +- provide logrotate configuration + * Tue Jan 15 2019 Remi Collet - 1.7-1 - initial package - open https://github.com/nginx/unit/pull/215 system crypto policy -- cgit