2 Replies Latest reply on Nov 24, 2013 11:25 PM by Chandra Suvro Bose

    Job is not getting executed using nsh script

      Hi,

       

      I tried to execute a software deploy job using BLCLI commands in NSH script.

       

      The script when run gives no error but the job does not get executed.

       

      I am attaching the script. Please check if I have done something wrong or missed some important steps and suggest appropriate changes that needs to be done.

       

      Thanks and Regards,

      Chandra

        • 1. Re: Job is not getting executed using nsh script
          Bill Robinson

          #!/bin/nsh

          blcli_setoption serviceProfileName defaultProfile

           

          blcli_setoption rolename BLAdmins

           

          blcred cred -acquire -profile defaultProfile -username BLAdmin -password Passw0rd123

          -> this are kind of out of order - do the blcred first then the setoptions.  if you are running this script as a nsh script job in bsa you dont need the above.

          blcli_connect

           

          JOB_FOLDER='/Jobs/My Sandbox/Software Deploy Job'

          -> unless you have a folder in the jobs workspace names 'Jobs' you don't need to prepend 'jobs'

          #echo " The Job Folder is $JOB_FOLDER "

           

          JOB_name='Adobe Flash MSI Package  Deploy Job'

           

          #echo "The Job Name is $JOB_name "

           

          JOB_KEY=`blcli DeployJob getDBKeyByGroupAndName '$JOB_FOLDER' '$JOB_name'`

          -> a few problems here:

           

          1 - a single quote around a variable prevents the shell from expanding the variable. 

          2 - if you are using the 'performance commands' (blcli_execute) then don't switch to using the blcli and spawning more jvms w/ the FOO=`blah`

           

          #echo " Got DB Key "

           

          JOB_RUN_KEY=`blcli DeployJob executeJobAndWait $JOB_KEY`

           

          #echo " JOB EXECUTED "

           

          try this instead:

           

          #!/bin/nsh

          blcred cred -acquire -profile defaultProfile -username BLAdmin -password Passw0rd123

          blcli_setoption serviceProfileName defaultProfile

          blcli_setoption rolename BLAdmins

          blcli_connect

           

          JOB_FOLDER="/My Sandbox/Software Deploy Job"

          echo " The Job Folder is $JOB_FOLDER "

          JOB_NAME="Adobe Flash MSI Package  Deploy Job"

          echo "The Job Name is $JOB_name "

          blcli_execute DeployJob getDBKeyByGroupAndName "${JOB_FOLDER}" "${JOB_NAME}"

          blcli_storeenv JOB_KEY

          echo "Job Key: ${JOB_KEY}"

          blcli_execute DeployJob executeJobAndWait ${JOB_KEY}

          blcli_storeenv JOB_RUN_KEY

          echo "Job Run Key: ${JOB_RUN_KEY}"

          • 2. Re: Job is not getting executed using nsh script

            Thanks a lot Bill,

             

            Its working !!!

             

             

            Regards,

            Chandra