[packages/cronie] Rel 2; protect crond slightly against oom

arekm arekm at pld-linux.org
Fri Aug 22 16:27:52 CEST 2025


commit 269fad4f06cfc886fdbaff13c36e78be81e7a45f
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Fri Aug 22 16:27:26 2025 +0200

    Rel 2; protect crond slightly against oom

 cronie.init | 11 +++++++++++
 cronie.spec |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/cronie.spec b/cronie.spec
index f168ca3..7bf4fd7 100644
--- a/cronie.spec
+++ b/cronie.spec
@@ -18,7 +18,7 @@ Summary:	Cron daemon for executing programs at set times
 Summary(pl.UTF-8):	Demon cron do uruchamiania programów o zadanym czasie
 Name:		cronie
 Version:	1.7.2
-Release:	1
+Release:	2
 License:	MIT and BSD and GPL v2
 Group:		Daemons
 #Source0Download: https://github.com/cronie-crond/cronie/releases
diff --git a/cronie.init b/cronie.init
index f86537b..5f33f32 100644
--- a/cronie.init
+++ b/cronie.init
@@ -17,10 +17,20 @@
 . /etc/rc.d/init.d/functions
 
 CROND_ARGS=""
+PIDFILE="/var/run/crond.pid"
+CROND_OOM_ADJUST=-200
 
 # Get service config
 [ -f /etc/sysconfig/cron ] && . /etc/sysconfig/cron
 
+adjust_oom() {
+    if [ -e $PIDFILE ]; then
+	for pid in $(cat $PIDFILE); do
+	    echo "$CROND_OOM_ADJUST" 2>/dev/null > /proc/$pid/oom_score_adj
+	done
+    fi
+}
+
 start() {
 	# Check if the service is already running?
 	if [ -f /var/lock/subsys/crond ]; then
@@ -41,6 +51,7 @@ start() {
 	daemon /usr/sbin/crond $CROND_ARGS
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/crond
+	adjust_oom
 }
 
 stop() {
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/cronie.git/commitdiff/269fad4f06cfc886fdbaff13c36e78be81e7a45f



More information about the pld-cvs-commit mailing list