I have a web site, running under linux/apache, that has a fairly large number of dynamic pages coded in perl. Most are fine, but I have a few specific perl scripts that are fairly resource intensive (they can put a rather large load on the server).
I'm not so concerned with how long they take to run; I would prefer to let them run longer but consume less CPU time. I know that nice will reduce the priority of a given script, but how does one implement that when the script is called via http rather than command line?
Are there commands other than nice that will keep a script under control, given there is no limitation on how long the script needs to run to completion?
I'd agree with Adam with the setpriority suggestion. It's the only way I can think of controlling individual scripts. With certain Apache modules like mod_fastcgi , you can control the priority of the processes, but it applies to everything.