I am trying to use monit to find surefire processes running too long and kill them.
The machine is running parallel builds so it is possible to have several surefire processes runnig at the same time but there is no PID file for those processes.
My monit config looks like this:
check process surefire matching "surefire/surefirebooter" if uptime > 4 hours then alert if uptime > 4 hours then stop
The alert is sent, but the stop does not work.
I can't use killall since the process is run by java and there is several other java processes running.
All I need is to detect thee right PID of that process so I can kill the right one.