Setting the site from within a TCL script

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Setting the site from within a TCL script

  • Creator
    Topic
  • #49371
    Carter Harrison
    Participant

      I’m trying to use the msi TCL extensions to do some reporting on the status of all threads in each site.  The problem I keep running into is that I’m unable to change sites from within the TCL script.  Running hcisetenv from within the script does not work.  Anybody have any ideas?  Many thanks.

    Viewing 3 reply threads
    • Author
      Replies
      • #61676
        Carter Harrison
        Participant

          Ah, nevermind.  I figured it out.

          TCL has a built-in array called ‘env’ that holds all of the processes environment variables.  To change the site:

          set env(HCISITE)

          set env(HCISITEDIR)

          Unfortunately, once you use msiAttach, you are locked into whatever the current site is, seeing as how there is no msiDetach (this should be a feature Quovadx!).

        • #61677
          Steve Carter
          Participant

            Not quite so….  ðŸ™‚

            After you set your new root/site, use the following command:

            setHciDirs

            Then do your msiAttach.

            Steve

          • #61678
            John Mercogliano
            Participant

              Carter,

               I’ve created a tcl proc that works well:

              Code:

              proc switchSite { siteName } {
              global env

              set bolSiteSwitched 0
              if { ! [catch {eval [exec ${::env(HCIROOT)}/sbin/hcisetenv -site tcl $siteName]} ] } {
              setHciDirs
              set bolSiteSwitched 1
              }
              return $bolSiteSwitched
              }

              You still will not be able to do what you want using the msi commands for all sites from within the same script.  Once you run the msiAttach command for a site from within tcl QDX does not provide anything to unattach from the current site and reattach after you set to a new site.  

              What I did was copied the hciconnstatus command and changed the emitSummary proc to return a space seperated string of all connections.

              Code:


              proc emitSummary { data } {
                     set lstConnList [list]
                     foreach entry $data {
                           lassign $entry process conn state pstatus time
                           lappend lstConnList $conn
                     }
                     puts [split $lstConnList]
              }

              I then exec my copy of hciconnstatus to get my list of connections.

              Hope this helps,

              John Mercogliano
              Sentara Healthcare
              Hampton Roads, VA

            • #61679
              David Barr
              Participant

                I’m on Cloverleaf 5.8.4, and I’m trying to get this working. Is msiDetach working in 5.8?

                Code:

                foreach site { site1 site2 } {
                   eval [exec $HciRoot/sbin/hcisetenv -site tcl $site]
                   setHciDirs
                   msiAttach
                   set toc [msiTocEntry]
                   for { set i 0 } { $i < [llength $toc] } { incr i } {
                       echo [lindex $toc $i]: [msiGetStatSample $i]
                   }
                   msiDetach
                }

                This is either printing the data from site1 twice or dying when trying to attach to site2 depending on which actual sites I choose for my site1 and site2.

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