[packages/earlyoom] Rel 2; add log file

arekm arekm at pld-linux.org
Fri Dec 8 12:12:00 CET 2023


commit 7c1a55c324ad862c48536f5cf545a4f38cbdf598
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Fri Dec 8 11:09:33 2023 +0100

    Rel 2; add log file

 earlyoom.init      | 2 +-
 earlyoom.logrotate | 5 +++++
 earlyoom.spec      | 7 +++++--
 3 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/earlyoom.spec b/earlyoom.spec
index 45513e3..d5828c6 100644
--- a/earlyoom.spec
+++ b/earlyoom.spec
@@ -1,13 +1,14 @@
 Summary:	Early OOM Daemon for Linux
 Name:		earlyoom
 Version:	1.7
-Release:	1
+Release:	2
 License:	MIT
 URL:		https://github.com/rfjakob/earlyoom
 Source0:	https://github.com/rfjakob/earlyoom/archive/v%{version}/%{name}-%{version}.tar.gz
 # Source0-md5:	9c567930c60b2ccdc536951b005d413d
 Source1:	%{name}.conf
 Source2:	%{name}.init
+Source3:	%{name}.logrotate
 BuildRequires:	pandoc
 Requires(post,preun):	/sbin/chkconfig
 Requires:	systemd-units
@@ -38,7 +39,7 @@ sed -i -e 's#/default/#/sysconfig/#g' Makefile earlyoom.service.in
 %install
 rm -rf $RPM_BUILD_ROOT
 
-install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
+install -d $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d}
 
 %{__make} install \
 	PREFIX=%{_prefix} \
@@ -48,6 +49,7 @@ install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
 	DESTDIR=$RPM_BUILD_ROOT
 
 cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -71,6 +73,7 @@ fi
 %defattr(644,root,root,755)
 %doc README.md
 %attr(754,root,root) /etc/rc.d/init.d/%{name}
+%config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
 %attr(755,root,root) %{_bindir}/%{name}
 %{systemdunitdir}/%{name}.service
 %{_mandir}/man1/%{name}.*
diff --git a/earlyoom.init b/earlyoom.init
index d594a3d..c1b29fd 100644
--- a/earlyoom.init
+++ b/earlyoom.init
@@ -27,7 +27,7 @@ start() {
 	fi
 
 	msg_starting "earlyoom"
-	daemon --fork --makepid /usr/bin/earlyoom $EARLYOOM_ARGS
+	start-stop-daemon --start --quiet --background --pidfile /var/log/earlyoom --exec /bin/sh -- -c "exec /usr/bin/earlyoom $EARLYOOM_ARGS 2> \"/var/log/earlyoom.log\"" && ok || fail
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/earlyoom
 }
diff --git a/earlyoom.logrotate b/earlyoom.logrotate
new file mode 100644
index 0000000..199a20e
--- /dev/null
+++ b/earlyoom.logrotate
@@ -0,0 +1,5 @@
+/var/log/earlyoom.log
+{
+    create 0644 root root
+    copytruncate
+}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/earlyoom.git/commitdiff/7c1a55c324ad862c48536f5cf545a4f38cbdf598



More information about the pld-cvs-commit mailing list