gerrit.sh: tell oom killer to respect us.
Since gerrit is usually a essential process that can consume a lot of memory and you might run other memory hogs (git gc, git repack) on the same machine, lets tell the oom killer that we prefer not to be killed. Currently this only works if we're root... And i don't know if the values is what we'd want to use in real life.
This commit is contained in:
parent
894154f155
commit
a32900fbc8
@ -425,6 +425,17 @@ case "$ACTION" in
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $UID = 0; then
|
||||
PID=`cat "$GERRIT_PID"`
|
||||
if test -f "/proc/${PID}/oom_score_adj" ; then
|
||||
echo -1000 > "/proc/${PID}/oom_score_adj"
|
||||
else
|
||||
if test -f "/proc/${PID}/oom_adj" ; then
|
||||
echo -16 > "/proc/${PID}/oom_adj"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
TIMEOUT=90 # seconds
|
||||
sleep 1
|
||||
while running "$GERRIT_PID" && test $TIMEOUT -gt 0 ; do
|
||||
|
Loading…
x
Reference in New Issue
Block a user