We have a script which runs on our web servers, triggered by customer action, which initiates a unix process to generate some cache files. Because this process acts upon files supplied by our customer, it sometimes misbehaves, running so long that the PHP process which spawns it times out or using so much CPU time that a sysadmin will kill it.
Is there any command which I could run which would limit the CPU time / runtime of the process? I am looking for a command like
/usr/bin/time, where I could run that command and pass it the commandline I want it to run and limit.