IBM Support

Get specific exit code corresponding LSB_JOBEXIT_STAT value in post_exec script

How To


Summary

The following steps are to get specific exit code corresponding to LSB_JOBEXIT_STAT value in post_exec script.

Objective

The environment variable LSB_JOBEXIT_STAT indicates job exit status. LSB_JOBEXIT_STAT is set to the exit status of the job before the post-execution command runs. The success or failure of the command takes no effect on LSB_JOBEXIT_STAT.

Steps

Test

exit code 130 corresponding to LSB_JOBEXIT_STAT = 33280

[userA@hostA conf]$ bsub -q admin -Ep "post.sh" sleep 1010
Job <476> is submitted to queue <admin>.

[userA@hostA conf]$ cat post.sh

#!/bin/sh

env > $LSF_ENVDIR/postouput

[userA@hostA conf]$ bjobs

JOBID   USER    STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME   SUBMIT_TIME

476    userA RUN   admin      hostA    hostA     sleep 1010 Aug 12 16:40

[userA@hostA conf]$ bkill 476

Job <476> is being terminated

[userA@hostA conf]$ grep LSB_JOBEXIT_STAT  postouput

LSB_JOBEXIT_STAT=33280

[userA@hostA conf]$ bjobs -l 476

Job <476>, User <userA>, Project <default>, Status <EXIT>, Queue <admin>, Command <sleep 1010>

Wed Aug 12 16:40:26: Submitted from host <hostA>,

................

Wed Aug 12 16:40:39: Exited with exit code 130. The CPU time used is 0.0 seconds.

Wed Aug 12 16:40:39: Completed <exit>; TERM_OWNER: job killed by owner.

................

Document Location

Worldwide

[{"Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSETD4","label":"Platform LSF"},"ARM Category":[{"code":"a8m50000000CeJaAAK","label":"A-Find Nothing"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]

Document Information

Modified date:
03 November 2020

UID

ibm16324627