Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have an interesting situation, I have a runaway ruby process - I know exactly how I trigger it.

Point is, it got me thinking about runaway processes (CPU usage or memory usage).

  • How would one monitor runaway processes with cron? grep / top / ulimit?

  • Can one notify the user via the
    command line if something like this
    happens?

  • What alternatives are there to Monit?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Instead of writing a script yourself you could use the verynice utility. Its main focus is on dynamic process renicing but it also has the option to kill runaway processes and is easily configured.

share|improve this answer
    
Thank you. It seems perfect for my situation. –  Forkrul Assail Nov 4 '10 at 6:21
    
Or Auto-Nice daemon -- same concept, different implementation. <and.sourceforge.net/>; –  mattdm Jan 2 '11 at 22:43

The more conventional way to do this would be by imposing hard limits via ulimit -- it can even stop a forkbomb. As Marcel Stimberg said, verynice is a similar utility but focuses solely on nice value rather than, say, limiting memory usage which was included in your question.

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.