cancel
Showing results for 
Search instead for 
Did you mean: 

max runtime for xsjob

patrickbachmann
Active Contributor
0 Kudos

Hi experts,

Has anybody written any code that will prevent an XS job from running past a certain time limit threshold?  I'd like to kill my job if it has been running for more than one hour for example.

Thanks,

-Patrick

Accepted Solutions (1)

Accepted Solutions (1)

pratik_doshi2
Participant
0 Kudos

    Hi Patrick,

    You can write script to monitor the table and kill the job based on these.

    Catalog  table  "_SYS_XS"."JOB_LOG"  can help you for these.

    If it gives error "Result job is running" then your job is running.

    Once finished it will be added to catalog table.

   Hope this helps.

    -

    Pratik

patrickbachmann
Active Contributor
0 Kudos

Ok so you're saying write a script, schedule it to run every hour or so and that script just constantly reads JOB_LOG and searches for an entry in this log each hour?  If it does not find a FINISHED status then it does a kill command of some sort.  Do you have that command?

Thanks

-Patrick

pratik_doshi2
Participant
0 Kudos

  Hi Patrick,

  You need to identify the session used by the job. Use table M_CONNECTIONS for that.

   Once you identified the session from M_CONNECTIONS use below mentioned query to disconnect the session.

  ALTER SYSTEM DISCONNECT SESSION '<connection_id>'

  Connection id is from M_CONNECTIONS.

   -

   Pratik

patrickbachmann
Active Contributor
0 Kudos

Interesting, thanks Pratik.  Let me experiment with this before closing this thread.

Answers (0)