Run a tcl proc in the backend

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Run a tcl proc in the backend

  • Creator
    Topic
  • #50911
    Bala Pisupati
    Participant

      Can anyone tell me how I can run a tcl proc in the backend with out using the gui?

    Viewing 1 reply thread
    • Author
      Replies
      • #67992
        garry r fisher
        Participant

          Hi Bala,

          What do you mean by ‘running a Tcl script in the back end without using the GUI’?

          Tcl scrips can be run from the command by leaving off the extension in *nix and adding .htc in Windows. Also you could run up Tclsh or winsh and run them there.

          If you provide more information on what you are trying to do I’ll what I can do to help.

          Regards

          Garry

        • #67993
          Russ Ross
          Participant

            I will offer some possible thoughts that pop into my mind when I read your question.

            To get to our back-end I open up an xterm onto our AIX cloverleaf server to get to the command prompt.

            If I want to simply test something out simple to understand a TCL command then I launch the interactive TCL interpreter via

            hcitcl

            If I want to write a stand-alone TCL script then I put these lines at the top of my TCL script and do a chmod 775 on the file

            Code:

            #!/usr/bin/ksh
            # this line to escape the next line from the tcl interpreter
            exec hcitcl “$0” “$@”

            There are some other variations of the lines that you can put at the top of a standalone TCL script to get it to work and perhaps some other clovertechies will post some of those.

            Once I have the script written I invoke it manually by typing the name of the script assuming it is in a directory in my path.

            Another common way I invoke a stand alone TCL script is to schedule it via cron.

            Here is a very simple example of one of our standalone TCL scripts  ( file_mtime.tcl ) to better complete the picture of what I’m describing:

            Code:

            #!/usr/bin/ksh
            # this line to escape the next line from the tcl interpreter
            exec hcitcl “$0” “$@”

            # Begin Module Header ==============================================================================
            #
            #——
            # Name:
            #——
            #
            # file_mtime.tcl
            #
            #———
            # Purpose:
            #———
            #
            # Display to sdtout the mtime (last modification time) of the specified file
            # In the following format:
            #
            # CCYY.MM.DD__HH.MM.SS
            #
            #——–
            # Inputs:
            #——–
            #
             set name [lindex $argv 0]
             if {[cequal $name “”]} then {exit}
            #
            #——-
            # Notes:
            #——-
            #
            # none
            #
            #———
            # History:
            #———
            #
            # 2001.02.16 Russ Ross
            #          – wrote initial version
            #
            # End of Module Header =============================================================================

            set type [file type $name]
            if [cequal “$type” “file”] {
               set mtime [file mtime $name]
               puts stdout [fmtclock $mtime “%Y.%m.%d__%H.%M.%S”]
            }

            If I do this at the AIX command prompt

            cd /usr/local/scripts

            file_mtime.tcl file_mtime.tcl

            then I get this displayed

            2005.08.03__16.45.48

            Russ Ross
            RussRoss318@gmail.com

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