Stop process at startup through tcl

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Stop process at startup through tcl

  • Creator
    Topic
  • #54690
    Tahir Shaikh
    Participant

      Hi,

      My requirement is to perform some validations in tcl and if validations fails then not to start process.

      For that, I have written validation logic inside inbound tps tcl’s start case.

      How should I stop the process there?

      Thanks,

      Tahir

    Viewing 5 reply threads
    • Author
      Replies
      • #82578
        Charlie Bursell
        Participant

          You will only access an IB proc when a message is received unless you put it all in start mode.  Or, as an alternative in the top of a namespace.  The namespace is run as soon as proc is loaded.

          Also consider a Protocol Startup proc.  Remember the magic command, engStartupSwitchThrow   😀

        • #82579
          Tahir Shaikh
          Participant

            Thanks Charlie for quick reply.

            I tried engStartupSwitchThrow command but it does not stop my Process.

            I am calling it from inbound tps -Start mode

          • #82580
            Charlie Bursell
            Participant

              You do not understand.  The command engStartupSwitchThrow is used *ONLY* in a Protocol Startup proc.  Until it is issued the thread cannot process messages.  That is probably where I would put the shutdown if I wanted to make sure I did not have to wait on a message or have a message partially processed.  Even if issued in startup mode of an IB proc there is the possibilty of messages before the shutdown.

              I am shooting in the dark here as I have no idea what you are really trying to do.

              However, if you want to stop the process, regardless of where you do it you should set up a shell script. or .bat file if on Windows.  In that script run the command “hcienginestop -p ” in the background.

              If done within the proc itself you are telling the proc to commit suicide – never a good thing.

              If you do this in a message processing mode you should also return the empty sting (“”) so any messages remain in the recovery database since the shutdown is not instantaneous.

              As stated above, a bit more insight into what you are really trying to do would be helpful.

            • #82581
              Tahir Shaikh
              Participant

                Yes, As you mentioned I tried engStartupSwitchThrow from protocol startup mode too, But it is not stopping the process.

                Thanks,

                Tahir

              • #82582
                Charlie Bursell
                Participant

                  You still do not understand.

                  engStartupSwitchThrow  is *NOT* used to stop a process!.  It release the message flow through the thread once your processing has finished in the Protocol Startup proc.

                  Did you not see my recommendation to exec a script?

                  I can offer no more unless I know what you are trying to do.  Stop the process based on what?

                • #82583
                  Elisha Gould
                  Participant

                    We use a global namespace variable that is set to a particular value when there is a critical issue that requires attention before proceeding.

                    If this variable is set, then we return no disposition in the run mode.

                    The result is that the messages will not process until whatever issue is fixed and the thread is restarted to initialise the stop variable.

                    FYI we use the proc name and connection name in the namespace to ensure each thread has a unique namepace for that proc.

                    ie:

                    Code:


                    namespace eval do_stuff_xlate${HciConnName} {
                       set gStop 0
                    }
                    proc do_stuff_xlate {args} {
                       global HciConnName

                    STARTUP CODE

                    IF FAILURE OCCURED {
                           set do_stuff_xlate${HciConnName}::gStop 1
                    }

                       if {[set do_stuff_xlate${HciConnName}::gStop]} {
                           return {}
                       }

                    RUN CODE

                    }

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