From 7e5e491592e6a589a670f5028cc9aba5c1f26d2a Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 6 Jan 2024 06:27:37 +0100 Subject: [PATCH] systemd support [release 3.8.8-2mamba;Fri Dec 26 2014] --- logrotate.service | 9 +++++++++ logrotate.spec | 40 ++++++++++++++++++++++++++-------------- logrotate.timer | 11 +++++++++++ 3 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 logrotate.service create mode 100644 logrotate.timer diff --git a/logrotate.service b/logrotate.service new file mode 100644 index 0000000..3edb8ef --- /dev/null +++ b/logrotate.service @@ -0,0 +1,9 @@ +[Unit] +Description=Rotate log files + +[Service] +Type=oneshot +ExecStart=/usr/sbin/logrotate /etc/logrotate.conf +Nice=19 +IOSchedulingClass=best-effort +IOSchedulingPriority=7 diff --git a/logrotate.spec b/logrotate.spec index 9f8358e..44973e5 100644 --- a/logrotate.spec +++ b/logrotate.spec @@ -1,6 +1,6 @@ Name: logrotate Version: 3.8.8 -Release: 1mamba +Release: 2mamba Summary: Rotates, compresses, removes and mails system log files Group: System/Tools Vendor: openmamba @@ -11,14 +11,15 @@ Source0: https://fedorahosted.org/releases/l/o/logrotate/logrotate-%{versi Source1: %{name}.conf Source2: %{name}.cron Source3: %{name}-init +Source4: %{name}.timer +Source5: %{name}.service License: GPL ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel BuildRequires: libpopt-devel BuildRequires: libselinux-devel ## AUTOBUILDREQ-END -Requires(pre): initscripts -Requires(post):chkconfig +Requires(post):systemd BuildRoot: %{_tmppath}/%{name}-%{version}-root %description @@ -40,25 +41,33 @@ Install the logrotate package if you need a utility to deal with the log files o make install PREFIX=%{buildroot} MANDIR=%{_mandir} install -D -m 644 %{S:1} %{buildroot}%{_sysconfdir}/logrotate.conf -install -D -m 755 %{S:2} %{buildroot}%{_sysconfdir}/cron.daily/logrotate -install -D -m 744 %{S:3} %{buildroot}%{_initrddir}/logrotate +#install -D -m 755 %{S:2} %{buildroot}%{_sysconfdir}/cron.daily/logrotate +#install -D -m 744 %{S:3} %{buildroot}%{_initrddir}/logrotate +install -D -m 644 %{S:4} %{buildroot}%{_unitdir}/logrotate.timer +install -D -m 644 %{S:5} %{buildroot}%{_unitdir}/logrotate.service install -d %{buildroot}%{_sysconfdir}/logrotate.d/ install -d %{buildroot}/var/lib touch %{buildroot}/var/lib/logrotate.status +install -d %{buildroot}%{_unitdir}/multi-user.target.wants %post if [ $1 -ge 1 ]; then -# new install - chkconfig --add logrotate + systemctl -q daemon-reload + systemctl -q enable logrotate.timer + systemctl -q start logrotate.timer fi -exit 0 +: -%preun +%postun if [ $1 -eq 0 ]; then -# erase - chkconfig --del logrotate + systemctl -q disable logrotate.tiemr fi -exit 0 +: + +%posttrans +# clean old sysv broken links +find /etc/rc[0-6].d/ -type l -xtype l -exec rm -f {} \; +: %clean [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" @@ -67,14 +76,17 @@ exit 0 %defattr(-,root,root) %{_sbindir}/logrotate %dir %{_sysconfdir}/logrotate.d -%{_sysconfdir}/cron.daily/logrotate %config(noreplace) %{_sysconfdir}/logrotate.conf %config(noreplace) %{_localstatedir}/lib/logrotate.status -%{_initrddir}/logrotate +%{_unitdir}/logrotate.service +%{_unitdir}/logrotate.timer %{_mandir}/man5/* %{_mandir}/man8/* %changelog +* Fri Dec 26 2014 Silvan Calarco 3.8.8-2mamba +- systemd support + * Mon Nov 03 2014 Automatic Build System 3.8.8-1mamba - automatic update by autodist diff --git a/logrotate.timer b/logrotate.timer new file mode 100644 index 0000000..38e6bda --- /dev/null +++ b/logrotate.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Daily rotation of log files + +[Timer] +OnCalendar=daily +AccuracySec=12h +Persistent=true +Unit=timer.service + +[Install] +WantedBy=multi-user.target