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.
diff --git a/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/gerrit.sh b/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/gerrit.sh
index 2a4991e..96e7dbb 100755
--- a/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/gerrit.sh
+++ b/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/gerrit.sh
@@ -425,6 +425,17 @@
       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