11 Replies Latest reply on Nov 23, 2011 7:37 AM by Bill Robinson

    Problem with Creating type-2 Script in BBSA v8.0.6.222

      Hi,

       

      I have a small issue with scripting that whenever i want to get some data from the Linux hosts , i have to create two script first is non-nsh type-3 and second is NSH type-1 script and after that i have to create a Batch Job fetch the data from all the system as i do not have Email Configured so far for BBSA. Please see the below sample scripts which i created for getting cpu info in Linux hosts.

       

      I have to create these two scripts as NSH is unable to recognized some OS commands. Could anyone let me know how i can reduce my work of creating 2 script Job and one Batch Job or anything which can be done via type-2 script. If so please provide me the info how to combine these two scripts into one. Please let me know if you need anyother info from my side.

      Thanks

       

       

      Non-Nsh Script type-3

      #/bin/nsh
      #Script Parameters
      output_file="/tmp/cpuinfo"

      #Cache Server list info

      host=`hostname`
              cpu=`cat /proc/cpuinfo|grep  processor |wc -l`
              echo  "$host:::$cpu number of cpus found" > "$output_file"
              

       

       

      NSH Script type-1

       

      #!/bin/nsh
      #Script Parameters
      echo "Assigning variables based on the script parameters"
      server_group=$2
      output_file=$3
      echo "Server group is $server_group"


      #Cache Server list info

      server_list=`blcli Server listServersInGroup "$server_group"`
      >$output_file
      for target in $server_list
      do
          cd //$target
          cat /tmp/cpuinfo >> "$output_file"
          
      done