Control-M-Java process that runs SQL query on UNIX box

Asked By 30 points N/A Posted on -
qa-featured

Hello,

 

We use Control-M (a scheduling program) to run various jobs on our servers. One in mainly is Java process that runs a SQL query on a UNIX box.

Most of the time everything's is perfect, but the huge application that takes longer than 45 minutes or so and never return 0 and will end up in executing forever until we manually kill them.

Is there any way to run a long-running process without killing the process to see that it's finished from either from the Java or UNIX side?

Thanks for the solutions.

SHARE
Answered By 0 points N/A #158745

Control-M-Java process that runs SQL query on UNIX box

qa-featured

Hello,

 

If you want to automate the way of stopping your java process after it becomes idle then here is how it can be done on UNIX.
First it has to be identified whether it is idle or not since you would not want to kill it if it was not idle.
 
The command to detect idle processes in UNIX is this: ps auxw
 
More fine-tuned: ps auxw|sort -r +3|head -10
 
Now putting everything in a script:
while true do 
sleep 50 
ps auxw | grep -i idle | kill `awk ' { print $2}'` 
done 
exit 0 
 
That is how to autokill an idle process.
 
Hope it helps.
 
Best Regards,
Parisi Petrusic

Related Questions