9

When my server runs into out-of-memory, it usually kills several applications. Is there any way how can i prevent from killing SSH. Because usually, when this out-of-memory error happens, my SSH is broken like this:

I connect to ssh server.
Enter username
Enter password
and then i wait
i wait
and wait...
and waaaaaaaaaait..
and then: Connection timed out.

Is there any way to prevent this?

2 Answers 2

6
+50

The renice command can be used to reset the priority of running processes or control the priority and scheduling of all processes owned by a user. Regular users can only numerically increase process priorities (that is, make tasks less important) using this command, but the root operator can use the full nice range of scheduling (-20 to 19). Lower number is higher priority. Most processes seem to run at nice of 0. If you run CLI top you'll see your running processes. The column labeled NI is the nice number. If you run CLI nice with no parameters you'll see:

Usage:

 renice [-n] priority [-p|--pid] pid  [... pid]

 renice [-n] priority  -g|--pgrp pgrp [... pgrp]

 renice [-n] priority  -u|--user user [... user]

 renice -h | --help

 renice -v | --version

I suggest you experiment as I have no infinite wisdom as to the right nice value for your purposes.

-2

Raise the niceness. Low-priority apps are killed first.

3
  • How can i do that?
    – Riki137
    May 7, 2011 at 18:59
  • How can i do that, please?
    – Riki137
    May 15, 2011 at 18:06
  • 1
    Can you expand your answer as to how these so-called low-priority apps can be killed?
    – Peachy
    Sep 7, 2012 at 21:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .