Linux: autokill a crashed / infinite loop process

Sometime a process can take 100% of all available cpu power because it crashed. Here is a little script I used on a server for pdftk because this software was crashing from time to time.

Just launch the script from a cron job and replace “PROCESS_NAME” by the name of the process to watch.

  • argument 1 : number of minutes after which the process will be killed
  • argument 2 : number of seconds

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.