Can I get currently running Jobs on a particular business host and hold them in a variable
I am working on automating to pick all the jobs running particular business process and kill them by using a routine. Though I was able to kill the jobs/PID on server by using (sudo kill jobid) and by using do $SYSTEM.Process.Terminate(jobid) or Do ##class(Ens.Job).UnRegister("buseiness host", jobid), I am looking to build a routine by setting a variable with all the business process names and then fetch the jobid or PID associated with those business process and kill them. Any help is highly appreciated.
Comments
Why do you want to kill all BH jobs directly?
You can just disable a BH and it would effectively do the same:
set sc = ##class(Ens.Director).EnableConfigItem(BH, 0)
Lebedyuk - We have to disable jobs/PID before disabling the BH as we are querying database. If you are still suggest that disbaling BH without killing jobs will not have any imapct let me know.
FYI- I am invoking above class for enabling and disabling BH.
Disabling BH gracefully shutdowns all BH jobs.