Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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.

share|improve this answer

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

share|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
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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