I know that I can do
ps aux | grep cgi to get a list of all cgi scripts currently running, and
ps -p [pid] -o etime= can get me the run time for each pid; is there a way to combine the two, or better still, only return those that have been running for "too long" (say, 45sec)?
Ideally, I'm looking for something that could be put into a perl script that looks out for issues, emails me the details and pro-actively kills the process "for safety". would it be better to just strap a the output from one, and then iterate through the results?