Cronjob to watch for runaway processes and kill them

command linecronprocess

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?

Best Answer

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.

Related Question