See
In reply to Re: Script for Killing Process of Long Running Time in Linux/Unix by Corion in thread Script for Killing Process of Long Running Time in Linux/Unix by monkfan