writing script that needs to change sites

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf writing script that needs to change sites

  • Creator
    Topic
  • #50146
    Paul Mitas
    Participant

      I am working on a script that needs to change sites. I have done this in the past in another life and it worked fine.

      I can setsite from a command line fine, but when I try to do it within the script it does not change. it does not error, but it does not change.

      Any ideas?

    Viewing 0 reply threads
    • Author
      Replies
      • #65011
        John Mercogliano
        Participant

          Here is a small proc I wrote that switches sites.  I’ve used successfully to run hcicmd commands to reload global tcl procs across multiple sites and run the hciprocstatus command.  One caveat, remember that the msiutil tcl commands will not work for multiple sites inside a single tcl program because there is no unattach command.

          Code:


          #
          # Procedure Name : shc_switchSite
          # Description    : Sets the tcl interpreters global environment to a particular site
          #                  so that both internal and external hci commands will work properly.
          #                  Also, ensures that all global variables in tcl and env represent
          #                  the selected site.
          # Input          : siteName – The site you wish to switch to
          # Return Value   : 1 if the environment was successfully switched to the new site
          #                  0 if the switch was unsuccessful.  This is usually caused by the
          #                    site not existing
          #
          proc shc_switchSite { siteName } {
          global env

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

          John Mercogliano
          Sentara Healthcare
          Hampton Roads, VA

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