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?


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:


 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.

| improve this answer | |

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.