5 Replies Latest reply on Nov 13, 2015 8:54 AM by Bill Robinson

    bulkSetServerPropertyValueAndlogResults

    Daniel Bousquin

      Hello,

       

      I'm trying to create a job that will use a server smart group for input
      and make a property change on each server in that smart group.

      I've been told to use either bulkSetServerPropertyValuesAndLogResults or bulkSetServerPropertyValues, likely
      because I'll be running against 1000's of servers.


      The bulk commands require a file for input, so I was going ot enumerate the smart group to a server I have
      and use it for input the the bulk command.

       

      I'm trying to issue:

       

      blcli_execute Server bulkSetServerPropertyValuesAndLogResults "//MyServerName/C/Temp" "My_Server_set_file.csv"


      I get an error : Cannot use remote path for file transfer. Source path is: //MyServerName/C/Temp/My_Server_set_file.csv

      I verified the file was created.

       

      What could be the problem?

        • 1. Re: bulkSetServerPropertyValueAndlogResults
          Bill Robinson

          The file needs to be on the same system that’s running the blcli.  you are trying to use a nsh path to reference a remote location to the file.

          • 2. Re: bulkSetServerPropertyValueAndlogResults
            Daniel Bousquin

            Hi Bill,

             

            I ran the script against a Windows server I have,

            In the c:\temp folder I have the file I want to use as input.. The command is

             

             

            pathtofile1="c/Temp"

             

            setfile="CServset.csv"

            blcli_execute Server bulkSetServerPropertyValuesAndLogresults  "${pathtofile1}" "${setfile}"

             

            The file exists but it give me a file not found.  Would I specify for pathtofile1?

            I've tried just about everything.. /c/Temp, /Temp ;... etc... ?

             

            Thanks

            -Dan

            • 3. Re: bulkSetServerPropertyValueAndlogResults
              Bill Robinson

              why are you running the job against anything ?  if you are just dumping properties and running the blcli command you can use the 'type 2' job and check the 'allow to run w/ no targets'.  since you are running it against a server i'm assuming you are using a 'type 1' (runscript) job.  so that will first cd to the target server and then any non-nsh paths will be relative to the target.

               

              so you can either change to a type 2 or if you stay w/ a type 1 in the first part of the script to:

               

              # cd back to the appserver running the job

              cd //@

              ### dump the smart group contents and build the file to /C/Temp which will be on the appserver running the job

              blcli_execute Server bulkSetServerPropertyValuesAndLogresults /C/Temp file.csv

              • 4. Re: bulkSetServerPropertyValueAndlogResults
                Daniel Bousquin

                I changed the job type to 2 and to allow to run with no targets.(This is all new)  Here is what I have.

                 

                # ********************************************
                # dumps out smart group to a temp file to be
                # used for input to bulkSetSererPropertyValuesAndLogResults
                #
                # ********************************************
                blcli_connect
                pathtofile="//MyServerName/c/Temp/CServset.csv"

                pathtofile1="/C/Temp"

                setfile="CServset.csv"

                if [ -f $pathtofile ]; then
                    echo "${pathtofile} exists.  Deleting ${pathtofile} "
                    rm "$pathtofile"
                   fi
                GRP="/PathtoServerGroup/ServerGroupName"
                echo "Using Server group $GRP"


                blcli_execute Server listServersInGroup "$GRP"
                blcli_storeenv srverlist


                for servs in $srverlist;
                do
                    echo "${servs},MYPROPERTY,3" >> ${pathtofile}
                done

                 

                echo "Parms passed would be ${pathtofile1} and ${setfile}"

                cd //@

                if [ -f $pathtofile ]; then
                    echo "${pathtofile} has been created. "
                   fi


                blcli_execute Server bulkSetServerPropertyValues ${pathtofile1} CServset.csv

                 

                 

                Here is where it's failing:

                on the bulkSetServerPropertyValuesAndLogResults above, I'm getting an error

                 

                java.io.FilenotFoundException: /C/Temp/CServset.csv ( no such file or directory ) yet the file is verified in the step above and is there when I login to the server.

                 

                I've tried hard coding the path and variables and it still fails.

                • 5. Re: bulkSetServerPropertyValueAndlogResults
                  Bill Robinson

                  blcli_connect

                  pathtofile="/c/Temp/CServset.csv"

                   

                  if [[ -f $pathtofile ]]; then
                      echo "${pathtofile} exists.  Deleting ${pathtofile} "
                      rm -f "${pathtofile}"
                  fi

                   

                  GRP="/PathtoServerGroup/ServerGroupName"
                  echo "Using Server group $GRP"


                  blcli_execute Server listServersInGroup "${GRP}"
                  blcli_storeenv srverlist


                  awk '{print $1",MYPROPERTY,3"}' > "${pathtofile}"

                   

                  echo "Parms passed would be ${pathtofile%/*} and ${pathtofile##*/}"

                   

                  if [[ -f "${pathtofile}" ]]; then
                       echo "${pathtofile} has been created. "
                       blcli_execute Server bulkSetServerPropertyValues "${pathtofile*/%}" "${pathtofile##*}"

                  else

                    echo "${pathtofile} doesn't exist"

                  exit 1

                  fi