1 Reply Latest reply on Sep 15, 2015 4:11 PM by Bill Robinson

    Blcli Import Export BatchJob

    STEFANO BRUTTO

      HI All,

       

      i need to create an nsh script depot that cycle to all my job folder structure and download to file system all batch job inlcuded in the job folder tree. I created a draft of the script, but I still have problems with the syntax blcli:

       

      JOBGROUP="/Jobs"
      GROUP_ID=`blcli_execute JobGroup groupNameToId $JOBGROUP`

       

      BATCHJOB_NAME=`JobGroup findAllGroupsByParentGroupName $JOBGROUP`
      echo ${BATCHJOB_NAME}
      BATCHJOB_DBKEY=`blcli BatchJob getDBKeyByGroupAndName $GROUP_ID $BATCHJOB_NAME`

       

      blcli_execute Group listAllJobGroupMembers 5005 $GROUP_ID
      blcli_storeenv jobList
      blcli_storeenv batchJobKey

       

      for job in "${jobList}"
      do

       

      echo ${jobList}
      echo ${BATCHJOB_DBKEY}

       

      blcli_execute ImportExport exportObject /c/temp

       

      done

       

       

       

      could you help me? Thanks in advance

        • 1. Re: Blcli Import Export BatchJob
          Bill Robinson

          there are a lot of things wrong here:

           

          JOBGROUP="/Jobs"

          -> do you have a folder named 'Jobs' at the root of the jobs workspace ?  otherwise the root of the workspace is just '/'
          GROUP_ID=`blcli_execute JobGroup groupNameToId $JOBGROUP`

          don't do FOO=`blcli_execute`, do

          blcli_execute JobGroup groupNameToId "${JOBGROUP}"

          blcli_storeenv GROUP_ID

          -> also put double quotes around strings that might have spaces.

           

          BATCHJOB_NAME=`JobGroup findAllGroupsByParentGroupName $JOBGROUP`

          -> there's no blcli call here, so this will fail.  also, this command would return a list of child groups in a group, not a batch job name.
          echo ${BATCHJOB_NAME}
          BATCHJOB_DBKEY=`blcli BatchJob getDBKeyByGroupAndName $GROUP_ID $BATCHJOB_NAME`

          -> so you are getting a batch job key w/ a batch job name that failed in the last command, so this won't work.

           

          blcli_execute Group listAllJobGroupMembers 5005 $GROUP_ID
          blcli_storeenv jobList
          blcli_storeenv batchJobKey

          -> you are storing the return from listAllJobGroupMembers twice in two different variables ?

           

          for job in "${jobList}"
          do

          echo ${jobList}

          -> if you are looping through a list, why are you echoing out the entire list in every loop ?
          echo ${BATCHJOB_DBKEY}

          -> not sure why are you are echoing the key here.

          blcli_execute ImportExport exportObject /c/temp

          -> command seems incomplete.

          done