]> git.pld-linux.org Git - packages/openssh.git/commitdiff
- prevent sshd from being killed via oom
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Wed, 23 Jul 2008 12:02:03 +0000 (12:02 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    opensshd.init -> 1.32

opensshd.init

index 798d514f2590c171141ac967e4e27a7260f771ef..17c2a2b9274cbc7f9c93c502eacb0ddff4a2381d 100644 (file)
@@ -8,6 +8,7 @@
 #              Ssh can be used for remote login, remote file copying, TCP port \
 #              forwarding etc. Ssh offers strong encryption and authentication.
 
+SSHD_OOM_ADJUST=-17
 
 # Source function library
 . /etc/rc.d/init.d/functions
@@ -28,6 +29,16 @@ else
        exit 0
 fi
 
+adjust_oom() {
+    if [ -e /var/run/sshd.pid ]; then
+       for pid in $(cat /var/run/sshd.pid); do
+               if [ -w "/proc/$pid/oom_adj" ]; then
+                   echo "$SSHD_OOM_ADJUST" > "/proc/$pid/oom_adj" 2> /dev/null || :
+               fi
+       done
+    fi
+}
+
 checkconfig() {
        /usr/sbin/sshd -t || exit 1
 }
@@ -63,6 +74,7 @@ start() {
                msg_starting OpenSSH
                daemon --pidfile /var/run/sshd.pid /usr/sbin/sshd
                RETVAL=$?
+               adjust_oom
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sshd
        else
                msg_already_running OpenSSH
This page took 0.040649 seconds and 4 git commands to generate.