How to automaticaly kill long-lasting processes under Linux?
Posted on 2007-11-24
I'd like to limit the allowed "CPU running time time" for particular applications running on the Linux server.
For instance, renice a PHP script (CGI mode, webhosting environment, PHP under user privileges, executed through Apache) after 1 minute and kill this script if it runs longer than 5 minutes.
Ulimit-based solution is insufficient. SPRI-based solution can only do the first part of such job.
I expect that the best solution would be a bash script executed from a cron job.
What script can perform such tasks?