3 Replies Latest reply on Jul 16, 2014 1:28 PM by richard mcleod

    NSH Type 2 Script job dumping serverlist to rscd logs

    richard mcleod

      So this is some behaviour I've never seen before...

       

      I wrote a type 2 script which seems to be dumping the serverlist targets to rscd logs... not sure how/why this is happening. Anyone else ever experience this?

       

      Script for reference:

      #set_SPP_version.nsh

      ########################

      # Requires the following parameters to be set in the Job:

      # 1 = %h (type-2 NSH)

       

       

      while getopts ":h:" opt;

      do

        case $opt in

        h)

        serverlist="$OPTARG"

        ;;

        \?)

        echo "Incorrect options found!" >&2

        exit 1

        ;;

       

        echo "Option -$OPTARG requires an argument" >&2

        exit 1

        ;;

        esac

      done

       

       

      PROPERTY="SPP_VERSION"

      CUR_DATE=$(date +%Y%m%d)

      LOG=/var/adm/bb/lnx_fw.log

      CSVFILE=set_spp_version_${CUR_DATE}.csv

      OUTDIR=/tmp

      OUTFILE=$(echo "${OUTDIR}/${CSVFILE}")

      ERROR=0

      ERRORMSG=""

       

       

      if [[ -f $OUTFILE ]]; then

        echo "OUTPUT FILE: $OUTFILE ALREADY EXISTS! EXITING!"

      # exit 1

      else

        touch $OUTFILE

      fi

       

       

      for servername in $serverlist

      do

        OLDVALUE=$(blcli_execute Server printPropertyValue $servername $PROPERTY)

        if [[ $? != "0" ]]; then

        ERRORMSG="Exit $? - WARN: Could not find system property ${PROPERTY} for server $servername.  Please verify the property exists."

        echo $ERRORMSG

        ERROR=0

        fi

       

        MANUFACTURER=$(blcli_execute Server getFullyResolvedPropertyValue $servername "MANUFACTURER")

       

       

        if [[ "$MANUFACTURER" = "HP" ]]; then

        if [[ -f //$servername/$LOG ]]; then

        SPP_VERSION=$(nexec $servername awk '$8~/^SPP.*/ {e=$8} END {if (!e) print "none"; else print e}' $LOG 2>/dev/null)

        else

        echo "//$servername/$LOG is MISSING! Setting value to NONE"

        SPP_VERSION="none"

        fi

        else

        echo "$servername has manufacturer of: $MANUFACTURER, Setting value to NONE"

        SPP_VERSION="none"

        fi

        echo "$servername,$PROPERTY,$SPP_VERSION"

        echo "$servername,$PROPERTY,$SPP_VERSION" >> $OUTFILE

      # if [[ $? -ne 0 ]]

      # then

      # ERRORMSG="ERROR: Failed to set server property ${PROPERTY}=${SPP_VERSION} on ${servername}."

      # ERROR=1

      # else

      # echo "INFO: Updated server $servername property ${PROPERTY}=${SPP_VERSION} from ${OLDVALUE}."

      # fi

        SPP_VERSION=

        MANUFACTURER=

      done

       

       

      #if [[ "$ERROR" -eq 1 ]]; then

      # echo "FAIL: $ERRORMSG"

      # exit 1

      #fi

       

       

      blcli_execute Server bulkSetServerPropertyValues ${OUTDIR} ${CSVFILE}

       

      ---------------------

       

      Pretty simple stuff, get the target list and loop through it, write output to file on the appserver (where the script is run), then run a bulk update. Not sure why (I'm assuming it's this script because the times match) this script is writing out the list of servers to the rscd.log on the targets

       

      from the rscd.log on a target host

      07/15/14 11:19:00.326 INFO     rscd -  njma06 57111 -1/-1 (Not_available): (Not_available): FIPS already enabled

      <space delimited list of 2000+ servers>

      07/15/14 11:19:00.335 INFO     rscd -  10.124.136.34 57111 0/0 (roles:me@domain.com): nsh: nsh /C/Program Files/BMC Software/BladeLogic/NSH/tmp/appserver02_job_2/scripts/job__606b11a4-66db-4387-894f-3bba2314c19b/script_DBKey-SJobKeyImpl-911677-2__ea3fc9dc-6edb-458a-a4b6-d59f91c2e280.377631.1_set_spp_version.nsh -h <list of hosts>

      next log entry...

       

      Is this a case of setting blcli to silent? (blcli_setjvmoption -Dcom.bladelogic.cli.execute.quietmode.enabled=true)