stop/start process with tcl script

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf stop/start process with tcl script

  • Creator
    Topic
  • #49866
    Nate Kruse
    Participant

      I’ve searched many times, but am hung up on this…

      I’m trying to write a tcl script that I’ll call from the clover tcl command window.

    Viewing 6 reply threads
    • Author
      Replies
      • #63929
        Scott Lee
        Participant

          Are you doing a setsite before that?

        • #63930
          Nate Kruse
          Participant

            Scott Lee wrote:

            Are you doing a setsite before that?

            No, I’m not.  I was figuring since my tcl code resides in a specific site and I am calling the tcl code from that site’s tclprocs folder, that I didn’t need to.  I will try it though.

          • #63931

            What do you mean by “clover tcl command window”?

            -- Max Drown (Infor)

          • #63932
            Scott Lee
            Participant

              If you do a ‘showroot’ you will see which site is the current site that the hci commands will be working on.  The current folder you are in does not tell hcienginestop which site to act upon.

              If that doesn’t help, maybe you could post the whole script?

              Scott

            • #63933
              Nate Kruse
              Participant

                Max Drown wrote:

                What do you mean by “clover tcl command window”?

                I cmd telnet into the clover server and manually run the tcl proc.

              • #63934
                Robert Milfajt
                Participant

                  I am guessing that you are running this TCL script from within one of the UPoCs in the engine.  We had to do something similar, but it was only stopping a thread and not the whole process.  What we have come up with (right or wrong), which seems to work OK is this.  We call a TCL proc from within the UPoC, called stop_thread:

                  Code:

                  proc stop_thread { thread { delay 5 } } {
                     global HciSiteDir   ;# Site Directory
                         echo “HCISITEDIR=>$HciSiteDir<"        set pname [get_pname $thread]        echo "Process=>$pname<"        system "$HciSiteDir/tclprocs/delay_hcicmd $delay $pname $thread pstop &" } proc get_pname { thread } {        set conndata [exec hciconndump $thread]        set lines [split $conndata n]        set thdinfo [lindex $lines 3]        set pname [lindex $thdinfo 0]        if {"$pname" == ""} {error "Thread not found: $thread"}        return $pname }

                  As you see this proc calls a KSH script (shown below) in the background, which sleeps for a period of time, and then runs hcicmd to stop the thread, to prevent other messages from processing during the delay.  I believe the reason was that you cannot stop a thread or process cleanly while working on a particular message, and needed to run it outside the UPoC.  There are other things the calling UPoC does to prevent other messages from processing until the thread stops.

                  Code:

                  # cat delay_hcicmd
                  #!/bin/ksh
                  sleep $1
                  hcicmd -p $2 -c “$3 $4 $5 $6 $7 $8 $9”

                  So depending on where you are with your call, you can do something similar, of course modify the hcicmd call to either hcienginestop or hcicmd -p $proc -c ‘. die’ to kill the process, however, you will probably need to address the fact that other messages will attempt to process until the actual process stop executes.

                  Hope this helps,

                  Robert Milfajt
                  Northwestern Medicine
                  Chicago, IL

                • #63935
                  Nate Kruse
                  Participant

                    All-

                    Thanks for all of the help and guidance.  It looks like I’m on the right path now as I am seeing positive results.

                    Nate.

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