1 Reply Latest reply on Jul 8, 2016 1:56 PM by Bill Robinson

    Trying to add list of servers to JOB through loop

    raj m

      while read line

      do

      line=`(echo ${line} | sed 's/ //g')`

      blcli_execute NSHScriptJob getDBKeyByGroupAndName "${JOB_GROUP_NAME}" "${JOB_NAME}"

      blcli_storeenv jobKey

      blcli_execute Job addTargetServer ${jobKey} "$line"

      blcli_execute NSHScriptJob getDBKeyByGroupAndName "${JOB_GROUP_NAME}" "${JOB_NAME}"

      blcli_storeenv jobKey

      done < Server.txt

       

      Server.txt contents are

      server1

      server2

      server3

       

       

      error:

      Untitleds.png

        • 1. Re: Trying to add list of servers to JOB through loop
          Bill Robinson

          - does the name in the text file match what's in bsa?

          - if you are trying to strip control characters, that's not how you do it.

           

           

          while read line

          do

          server="$(echo "${line}" | tr -d '[:cntrl:]')"

          blcli_execute NSHScriptJob getDBKeyByGroupAndName "${JOB_GROUP_NAME}" "${JOB_NAME}"

          blcli_storeenv jobKey

          blcli_execute Job addTargetServer ${jobKey} "${server}"

          blcli_execute NSHScriptJob getDBKeyByGroupAndName "${JOB_GROUP_NAME}" "${JOB_NAME}"

          blcli_storeenv jobKey

          done < Server.txt

          1 of 1 people found this helpful