Hello,

the attached patch is supposed to enable users to override the taskomatic config
option 'wrapper.java.maxmemory' via the global rhn.conf file. As the key I chose
'taskomatic.maxmemory', but feel free to propose something else in case you 
don't
like it.

Some of our users had issues with the default value of 1024 and increasing the
value fixes their problems. Further, since nobody is supposed to edit the 
default
config files in /usr/share/rhn/config-defaults/, there is a necessity for such a
patch. I hope you like the idea.

Regards,
Johannes

-- 
SUSE LINUX Products GmbH, HRB 16746 (AG Nürnberg)
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer
>From bff7c320b8b6a20f1f829982a166077e07989afa Mon Sep 17 00:00:00 2001
From: Johannes Renner <jren...@suse.de>
Date: Fri, 13 Sep 2013 11:11:13 +0200
Subject: [PATCH] Make taskomatic max memory configurable via rhn.conf

---
 java/scripts/taskomatic | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/java/scripts/taskomatic b/java/scripts/taskomatic
index 8eda04b..36bd9be 100755
--- a/java/scripts/taskomatic
+++ b/java/scripts/taskomatic
@@ -146,6 +146,12 @@ then
     fi
 fi
 
+# Read 'wrapper.java.maxmemory' from rhn.conf as 'taskomatic.maxmemory'
+MAX_MEMORY=$( grep -E -m1 "^taskomatic.maxmemory[[:space:]]*=" /etc/rhn/rhn.conf | sed "s/^taskomatic.maxmemory[[:space:]]*=[[:space:]]*\(.*\)/\1/" || echo "" )
+if [ ! -z "${MAX_MEMORY}" ]; then
+  MAX_MEMORY="wrapper.java.maxmemory=${MAX_MEMORY}"
+fi
+
 getpid() {
     if [ -f $PIDFILE ]
     then
@@ -186,9 +192,9 @@ console() {
     then
         if [ "X$IGNORE_SIGNALS" = "X" ]
         then
-            exec $CMDNICE $WRAPPER_CMD $WRAPPER_CONF wrapper.pidfile=$PIDFILE
+            exec $CMDNICE $WRAPPER_CMD $WRAPPER_CONF $MAX_MEMORY wrapper.pidfile=$PIDFILE
         else
-            exec $CMDNICE $WRAPPER_CMD $WRAPPER_CONF wrapper.pidfile=$PIDFILE wrapper.anchorfile=$ANCHORFILE
+            exec $CMDNICE $WRAPPER_CMD $WRAPPER_CONF $MAX_MEMORY wrapper.pidfile=$PIDFILE wrapper.anchorfile=$ANCHORFILE
         fi
     else
         echo "$APP_LONG_NAME is already running."
@@ -205,16 +211,16 @@ start() {
         then
             if [ "X$RUN_AS_USER" = "X" ]
             then
-                exec $CMDNICE $WRAPPER_CMD $WRAPPER_CONF wrapper.pidfile=$PIDFILE wrapper.daemonize=TRUE
+                exec $CMDNICE $WRAPPER_CMD $WRAPPER_CONF $MAX_MEMORY wrapper.pidfile=$PIDFILE wrapper.daemonize=TRUE
             else
-                /sbin/runuser -m $RUN_AS_USER -c "exec $CMDNICE $WRAPPER_CMD $WRAPPER_CONF wrapper.pidfile=$PIDFILE wrapper.daemonize=TRUE"
+                /sbin/runuser -m $RUN_AS_USER -c "exec $CMDNICE $WRAPPER_CMD $WRAPPER_CONF $MAX_MEMORY wrapper.pidfile=$PIDFILE wrapper.daemonize=TRUE"
             fi
         else
             if [ "X$RUN_AS_USER" = "X" ]
             then
-                exec $CMDNICE $WRAPPER_CMD $WRAPPER_CONF wrapper.pidfile=$PIDFILE wrapper.anchorfile=$ANCHORFILE wrapper.ignore_signals=TRUE wrapper.daemonize=TRUE
+                exec $CMDNICE $WRAPPER_CMD $WRAPPER_CONF $MAX_MEMORY wrapper.pidfile=$PIDFILE wrapper.anchorfile=$ANCHORFILE wrapper.ignore_signals=TRUE wrapper.daemonize=TRUE
             else
-                /sbin/runuser -m $RUN_AS_USER -c "exec $CMDNICE $WRAPPER_CMD $WRAPPER_CONF wrapper.pidfile=$PIDFILE wrapper.anchorfile=$ANCHORFILE wrapper.ignore_signals=TRUE wrapper.daemonize=TRUE"
+                /sbin/runuser -m $RUN_AS_USER -c "exec $CMDNICE $WRAPPER_CMD $WRAPPER_CONF $MAX_MEMORY wrapper.pidfile=$PIDFILE wrapper.anchorfile=$ANCHORFILE wrapper.ignore_signals=TRUE wrapper.daemonize=TRUE"
             fi
         fi
     else
-- 
1.8.1.4

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to