sshd: add fallback for oom setings with old kernel.
authorArne Fitzenreiter <arne_f@ipfire.org>
Sat, 3 May 2014 13:05:20 +0000 (15:05 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Sat, 3 May 2014 13:05:20 +0000 (15:05 +0200)
src/initscripts/init.d/sshd

index 0ed8661..1d61a63 100644 (file)
@@ -43,7 +43,10 @@ case "$1" in
        (
                sleep 3
                pid=$(cat /var/run/sshd.pid 2>/dev/null)
-               [ -n "${pid}" ] && echo "-16" > "/proc/${pid}/oom_score_adj"
+               [ -n "${pid}" ] && [ -e "/proc/${pid}/oom_score_adj" ] && \
+                                       echo "-16" > "/proc/${pid}/oom_score_adj" || \
+                               [ -e "/proc/${pid}/oom_adj" ] && \
+                                       echo "-16" > "/proc/${pid}/oom_adj"
        ) &
         ;;