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.

Is there anyway to prevent a process from being killed no matter what? I know about nice but I'm not sure if giving a task such as a long running memory-intensive rake task the highest priority will prevent it from being killed off:

nice -n -20 rake xyz
share|improve this question

2 Answers 2

up vote 2 down vote accepted

Why would it be killed off?

Because it's not automatic that something is killed. Once you answer that, and explain why something would be selected for destruction, you might be able to come up with a solution.

Given you're talking about Rails' rake command, I'm guessing that this is a process running on a server. That you're worried about it being killed suggests it's being killed by the server host for using too many resources. In cases like this, there aren't (nor should there be) ways of stopping your process for being killed.

If you have a resource-expensive task, buy more resources. Use your own server time. Or come to an arrangement with the host that allows you to run it on their dime.

share|improve this answer

You can not prevent root from killing a process. Or for that matter: you can not prevent the server from killing a process that eats up all your resources.

What you can do is fork the command so it restarts itself when killed.

Example using code:

share|improve this answer

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.