looking for a generic script to stop all the inbound thread

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf looking for a generic script to stop all the inbound thread

  • Creator
    Topic
  • #55412
    Mahmoud Ihaddadene
    Participant

      Hi,

      I’m looking for a generic script to stop all the inbound threads that are configured in different sites and processes.

      Best Regards,

      Mahmoud

      Mcgill Univesity Health Centre

    Viewing 2 reply threads
    • Author
      Replies
      • #85235
        Peter Heggie
        Participant

          unix or windows?

          Peter Heggie

        • #85236
          Mahmoud Ihaddadene
          Participant

            Hi,

            Unix…we are running cloverleaf under Aix.

            Thanks,

          • #85237
            Peter Heggie
            Participant

              Here is a script to get all the sites and then all the processes in a site. It is a UNIX shell script.

              I do have another script, a tcl scrip, that will get all inbound threads, but it is very crude, except for the parts I copied from Clovertech. I hesitate to share it yet because I think there is a better way to code it.

              I think there must be a way to read in a copy of the NetConfig and treat each thread definition (protocol) as a keyed list, and then use keylget commands to get the thread name and the OUTBOUNDONLY parameter. Maybe someone can share that code.

              I must warn you that the method I used to identify an inbound script is not 100% accurate. Because Cloverleaf is so flexible, any thread can be used for both inbound and outbound messaging. So what I did was to identify any thread that did not have the OUTBOUNDONLY check box checked on the Inbound configuration section (value not equal to 1). So that may not be correct for each interface.

              Also, it does not actually issue the Stop command, but you can add that function to the script without much effort, right in the section of code that returns the names of the inbound threads.

              Code:

              #!/usr/bin/ksh

              clversion=”cis6.1″
              hld=”prod”
              tmpcfg=”/tmp/hci_temp_netconfig.txt”

              sites=`ls /$hld/$clversion/*/NetConfig | awk -F/ ‘{print $4}’`
              for site in $sites
                do
                  setsite $site
                  echo “——————————————————————”
                  echo “site: $site”
                  cat /$hld/$clversion/$site/NetConfig > $tmpcfg

                  # loop through each process in the site
                  processes=`ls /$hld/$clversion/$site/exec/processes`
                  for process in $processes;do
                    echo ”  process: $process”
                    # loop through each thread
                    threads=`getProcessInboundThreads.tcl $site $tmpcfg $process`
                    for thread in $threads;do
                      echo ”    inbound thread: $thread”
                    done
                  done
               done

              exit 0

              getProcessInboundThread.tcl

              Code:

              #! /usr/bin/ksh
              # The following line is seen as a continuecomment by Tcl
              exec $QUOVADX_INSTALL_DIR/integrator/bin/hcitcl “$0” ${1+”$@”}

              set site [lindex $argv 0 ]
              set cfile [lindex $argv 1]
              set process [lindex $argv 2]

              set hfile [open $cfile r]
              set config [read $hfile]
              close $hfile

              set threads {}
              set ct 0

              set lconfig [split “$config” “n”]
              foreach line $lconfig {
               if {[string range $line 0 7] eq “protocol”} {
                 set thread [lindex [split $line ” “] 1]
                 
                 set start [string first “protocol $thread” “$config”]
                 set start [expr $start + 9 + [string length $thread]]
                 set end [expr [string first “nprotocol” “$config” $start] – 1]
                 if {$end < 0} {
                   set kprotocol [string range "$config" $start end]
                 } else {
                   set kprotocol [string range "$config" $start $end]
                 }
                 set start [expr [string first "{" "$kprotocol"] + 1]
                 set end [expr [string last "}" "$kprotocol"] – 1]
                 set kprotocol [string range "$kprotocol" $start $end]
                 set tprocess [keylget kprotocol PROCESSNAME]
                 set tprocess [string trim "$tprocess"]
                 if {"$tprocess" eq "$process"} {
                   set outboundonly [keylget kprotocol OUTBOUNDONLY]
                   if {!$outboundonly} {
                     lappend threads $thread
                   }
                 }
               }
              }
              set newthreads [lsort -unique $threads ]
              foreach thread $newthreads {echo $thread}
              exit 0

              Peter Heggie

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