Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

SIGINT to terminate a batch job?

 
Rene L.
Occasional Visitor

SIGINT to terminate a batch job?

Hello,

I've a java program with a shutdownhook to catch a ctrl+c to clean some things before terminating.
Now I wanted to start the program with a submit and wondered if I can do a normal shutdown of the application.
Is there any way to do this or is a batch job always terminated abruptly?

Thanks in advance.
6 REPLIES 6
Joseph Huber_1
Honored Contributor

Re: SIGINT to terminate a batch job?

Ctrl+C sends a SIGINT (signal 2) to the image.
So if You send a signal 2 , the program should see no difference.
There are Unix-compatible KILL programs to send a signal, either in GNV or else on the freeware.

kill -2 procid

Process-id can be found if You know the batch entry number, by default the process name is BATCH_entry .
http://www.mpp.mpg.de/~huber
Heuser-Hofmann
Frequent Advisor

Re: SIGINT to terminate a batch job?

Standard dcl can do this:

delete/entry=entry-# queue-name

Joseph Huber_1
Honored Contributor

Re: SIGINT to terminate a batch job?

Ah yes, delete/entry results in stop/entry for a running job.

BTW, instead of using SIGINT or other signals, the program could simply establish an EXIT routine ( atexit(exitproc) in C, don't know the corresponding Java call).
A stop/entry is then forcing the exit routine call.
http://www.mpp.mpg.de/~huber
Rene L.
Occasional Visitor

Re: SIGINT to terminate a batch job?

Thanks for the answers, but in this case, the delete or stop command to stop the job, acts in the same way as a crtl-y. I need a ctrl-c which does no force exit of the program.
Joseph Huber_1
Honored Contributor

Re: SIGINT to terminate a batch job?

Easy to confuse:
A stop/entry just forces exit, i.e. invokes an "atexit" routine.
Sending a signal 2 (KILL -SIGINT) is invoking a routine established by a signal(SIGINT,routine) call.

So my first answer told to use KILL on the process-id.
Stop/entry invokes only the exit routine, not the signal catcher.
I assume Your "shutdownhook to catch a ctrl+c" is a signal handler.
http://www.mpp.mpg.de/~huber
Rene L.
Occasional Visitor

Re: SIGINT to terminate a batch job?

Ok, will try that and provide feedback.
Thanks.