7 Replies Latest reply on Feb 11, 2014 5:33 AM by Bill Robinson

    Getting jobrunID (JobRunID or JobRunDBKey) for currently running NSH ScriptJob type 1.

    Petr Lampart


      we are executing NSH Script job type 1 from UI.


      What we would like to achieve is to get actual JobRunID. So that NSH subjob will always know it's parent Job Run ID or DB Key so that we can use this number to gather results from all the servers and to create CSV with our script output for each run id.


      Currently we are using this workaround:


      JObID=`echo ${0} | sed "s/.*_\(DBKey.*\)__.*/\1/g" | sed "s/-/:/1" | sed "s/-/:/1"`

      echo "NSH Script JobID "${JObID}


      JobRun=`blcli_execute JobRun findLastRunKeyByJobKey $JObID`

      echo "RunKey - DBKEY" ${JobRun}


      But this script can take long time to finish and if someone will execute job again, already running subjobs will get wrong JobRun Key (That one from newly executed (latest) job).


      Please is there a way to get easily JobRunKey or JobRunId information from currently running NSH Script Job ?


      Many thanks, Petr