Get site and host name in tcl

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Get site and host name in tcl

  • Creator
    Topic
  • #55281
    Usman Azher
    Participant

      Is there a way to access the host, site, process, and thread names in a TCL script? I have a script that shuts down a thread after failing to send a message after 10 retries. It then sends an e-mail to our group. I would like to incorporate the names in the subject of the e-mail.

    Viewing 6 reply threads
    • Author
      Replies
      • #84792
        Michael Hertel
        Participant

          proc cis_optum_bdpqi_fix { args } {

             keylget args MODE mode

             global HciSite HciConnName

             set procname [lindex [info level [info level]] 0]

             set module “$HciSite/$HciConnName/$procname: “

             set dispList {}

             switch -exact — $mode {

                 start {

        • #84793
          Usman Azher
          Participant

            Thank you. I was able to get the site and thread name. Is there a way to get the host name as well? The reason I ask is that we have two cloverleaf servers.

          • #84794
            Michael Hertel
            Participant

              When I get an alert from one of my engines, I look at who sent me the email.

              CLOVERLEAF Interface Engine – PPCF <hci@ppcf.internal.vmmc.org>

              or

              CLOVERLEAF Interface Engine – PPCG <hci@ppcg.internal.vmmc.org>

              But you should be able to get the hostname

              echo $env(HOST)

            • #84795
              Charlie Bursell
              Participant

                All of your environment names are available in Tcl via the global array env like:

                set host $::env(HOSTNAME), etc.

                You get process name easy.    set process [file tail [pwd]]  since the engine always runs in the process directory

              • #84796

                global HciRoot HciRootDir HciMasterSite HciMasterSiteDir HciSite HciSiteDir

                -- Max Drown (Infor)

              • #84797
                Charlie Bursell
                Participant

                  He also wanted host name.  You can get all from the environment

                • #84798
                  David Barr
                  Participant

                    $::env(HOSTNAME) works. You can also use [info hostname].

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