2 Replies Latest reply on Mar 4, 2013 7:28 PM by John NameToUpdate

    How to view the status of a job

      Hi everyone,

       

      I'm looking fow a way to view the status of a job (Completed, running, not completed ...).

       

      I have created a NSH script that deploy a job with these command:

       

       

      JOB_KEY=`blcli DeployJob getDBKeyByGroupAndName "$JOB_FOLDER" "$JOB_NAME"`

      JOB_RUN=`blcli Job executeAgainstServersForRunID "$JOB_KEY" "$SERVER"`

      RUN_KEYS=`blcli JobRun findAllRunKeysByJobKey $JOB_KEY`

       

      Now, I would like to know if the job is completed.

      Does it have a command for this?

      Thanks for your attention.

       

       

        • 1. Re: How to view the status of a job
          Siddu angadi

          Hi Ben,

           

          Please refer the https://communities.bmc.com/communities/message/303721#303721

           

          as example:

           

          #############################################################

           

           

          blcli_execute DeployJob executeJobAndWait "$JOB_KEY"

          blcli_storeenv RUN_KEY

          echo RUN KEY is: $RUN_KEY

           

           

          blcli_execute JobRun jobRunKeyToJobRunId "$RUN_KEY"

          blcli_storeenv RUN_ID

           

           

          echo RUN ID is: $RUN_ID

           

           

          blcli_execute JobRun getJobRunHadErrorsById "$RUN_ID"

          blcli_storeenv DeployJob_status

           

           

          echo DeployJob_status is: $DeployJob_status

           

           

          if [ "$DeployJob_status" = "true" ]

          then

                 echo Deploy Job job failed

                 exit 1

          else

                 echo Deploy Job completed successfully

          fi

           

           

          ##############################################################

           

           

          Thanks

          Siddu

          • 2. Re: How to view the status of a job

            Actually, the above solution only works part of the time. The problem is centered around the method "getJobRunHadErrorsById". About 25% of the time it does not return the correct boolean for the batch run status. I was just about to post a new discussion on this method too as i've been banging my head against the wall trying to get the above nshell code to both function correctly and consistently.

             

            Case in point: this afternoon 2 out of 9 nshell jobs with the code above showed that the batch job spawned had no errors, but they did end up erroring out. From the Console Manger...two big red x marks on them.

             

            John