[25393] in Source-Commits
/svn/athena r24948 - trunk/debathena/debathena/pyhesiodfs/debian
daemon@ATHENA.MIT.EDU (Geoffrey Thomas)
Sun Feb 13 22:08:23 2011
Date: Sun, 13 Feb 2011 22:08:17 -0500
From: Geoffrey Thomas <geofft@MIT.EDU>
Message-Id: <201102140308.p1E38Hit015235@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: geofft
Date: 2011-02-13 22:08:17 -0500 (Sun, 13 Feb 2011)
New Revision: 24948
Modified:
trunk/debathena/debathena/pyhesiodfs/debian/changelog
trunk/debathena/debathena/pyhesiodfs/debian/debathena-pyhesiodfs.init
Log:
In pyhesiodfs:
* Set /proc/$pid/oom_adj to -17 (never OOM kill this process).
Code loosely adapted from ssh's initscript.
Modified: trunk/debathena/debathena/pyhesiodfs/debian/changelog
===================================================================
--- trunk/debathena/debathena/pyhesiodfs/debian/changelog 2011-02-13 20:58:03 UTC (rev 24947)
+++ trunk/debathena/debathena/pyhesiodfs/debian/changelog 2011-02-14 03:08:17 UTC (rev 24948)
@@ -1,3 +1,10 @@
+debathena-pyhesiodfs (0.0.r167-0debathena6) unstable; urgency=low
+
+ * Set /proc/$pid/oom_adj to -17 (never OOM kill this process).
+ Code loosely adapted from ssh's initscript.
+
+ -- Geoffrey Thomas <geofft@mit.edu> Sun, 13 Feb 2011 22:06:57 -0500
+
debathena-pyhesiodfs (0.0.r167-0debathena5) unstable; urgency=low
* Fix package name in maintainer scripts
Modified: trunk/debathena/debathena/pyhesiodfs/debian/debathena-pyhesiodfs.init
===================================================================
--- trunk/debathena/debathena/pyhesiodfs/debian/debathena-pyhesiodfs.init 2011-02-13 20:58:03 UTC (rev 24947)
+++ trunk/debathena/debathena/pyhesiodfs/debian/debathena-pyhesiodfs.init 2011-02-14 03:08:17 UTC (rev 24948)
@@ -23,6 +23,7 @@
DAEMON_ARGS="-f $pyhesiodfs_dir -o nonempty"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
+oom_adj=-17
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
@@ -30,6 +31,13 @@
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Are we in a virtual environment that doesn't support modifying
+# /proc/self/oom_adj?
+if grep -q 'envID:.*[1-9]' /proc/self/status; then
+ unset oom_adj
+fi
+
# Load the VERBOSE setting and other rcS variables
: ${VERBOSE:=yes}
if [ -f /lib/init/vars.sh ]; then
@@ -69,6 +77,10 @@
--exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
+
+ if [ -n "$oom_adj" ] && [ -w /proc/"$(cat "$PIDFILE")"/oom_adj ]; then
+ echo "$oom_adj" > /proc/"$(cat "$PIDFILE")"/oom_adj
+ fi
}
#