hcicyclesavemsg script not woking properly

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf hcicyclesavemsg script not woking properly

  • Creator
    Topic
  • #49941
    Hongle Sun
    Participant

      Hello, We have this script running for years… just found that one outbound thread can not be processed by this script recently.. .Basically this script will check the very connection … can anyone tell me what does highlighted the statement mean?

      sub ckconnStatus {

      #; check connection status

      open(NETCONFIG,”grep ‘^protocol’ $netconfig |”) || return 0;

      @NETCONFIG = ;

      close(NETCONFIG);

      foreach $proc (@procs) {

      open(CONNSTATUS,”hciconnstatus |grep ‘^$proc ‘ |”)

        || die “Cannot access hciconnstatus”;

       $procpath = $rootpath . “/” . $site . “/exec/processes/” . $proc;

      while () {

      chop;

      if (/^S+s+(S+)s+ups+S+.*$/) { ($conn) = $1;

      foreach (@NETCONFIG) {

      $NCline = $_;

      chop($NCline);

      if ($NCline =~ /^protocol ($connS*).*$/) ($conn) = $1;

        printf(“nProcessingn    Root: %s, site: %s, proc: %s, thread: %sn”,$rootpath,$site,$proc,$conn);

      last;

      }

      }

      &ckSavemsgs;

      }

      }

      close(CONNSTATUS);

        }

      return 1;

      }

      Thanks

    Viewing 5 reply threads
    • Author
      Replies
      • #64188
        Tom Rioux
        Participant

          It is pattern matching that is searching the results of hciconnstatus, such as:

          adt    to_ecl_ip_a    up   up   Tue Feb 19 16:23:02

          and returning the various columns listed above.

          It is applying it as such:

          (/^S+s+(S+)s+ups+S+.*$/) { ($conn) = $1;

          ^ is anchoring the pattern match to the beginning of the line

          The first S+ is searching and will match any non-white space.  It will result in a match on “adt” in the output listed above.

          The first s+ is searching for and wil match any white space.  It will match the space between the first and second column.  

          The second S+ (in parantheses) will match whatever is listed in the second column which is the connection name. The parantheses around it means that it will take whatever the S+ returns (in this case, the connection name), and place it in a variable.  The variables returned by these are labeled as $1, $2, $3, and so on.  In your case, it is taking the connection name and placing it in the variable $1, which your script turns around and sets the variable $conn with it.

          The other s+ is returning the whitespace between the columns.

          The word “up” is looking for the literal word up in the next column.

          The .* will match anything at the end.

          Hope this helps a bit….

          Tom Rioux

          Baylor Health Care Systems

        • #64189
          Jerry Tilsley
          Participant

            Any way to adjust this type script if the thread name is too long and isn’t fully display by hciconnstatus?

          • #64190
            Steve Carter
            Participant

              I would create another version of hciconnstatus and just change the formatting of the output string.

              Here’s the snippet that I changed in my version:

              set hfmt “%-20.20s %-50.50s %-10.10s %-15.15s %-20.20s” ;# Heading format

              set fmt “%-20.20s %-50.50s %-10.10s %-15.15s %-20.20s” ;# Output line format

              Hope this helps.

              Steve

            • #64191
              Alan Fleming
              Participant

                We have modified the following line in both hciconnstatus and hciprocstatus to allow longer names.

                set fmt “%-32.32s %-32.32s %-10.10s %-15.15s %-20.20s” ;# Output line format

                Works well

              • #64192
                Charlie Bursell
                Participant

                  Instead of modifying hciconnstatus why not simply use msiAttach?

                  Or you can grep the names right out of NetConfig:

                      grep protocol NetConfig | cut -f 2 -d ” “

                  Why do we always make it so hard  ðŸ˜€

                • #64193
                  Robert Milfajt
                  Participant

                    Well Charlie, my car is running rough, so I should replace the engine, right?

                    I like the way you think!

                    Robert Milfajt
                    Northwestern Medicine
                    Chicago, IL

                Viewing 5 reply threads
                • The forum ‘Cloverleaf’ is closed to new topics and replies.