Too clever?

  • Creator
    Topic
  • #48991
    garry r fisher
    Participant

      Hi,

      I need to write a series of maintenance scripts for our support team that will stop and start whole sites, processes or individual threads. I thought I could do this in Tcl and a sample script is shown below that I thought would do the trick for stopping a whole site cleanly.

      netcfgLoad

      foreach proc [netcfgGetProcList] {

         foreach thread [lsort [netcfgGetProcConns $proc]] {

            catch {exec hcicmd -p $proc -c “$thread pstop”}

         }

      }

      The problem I have is when I run this from a Cloverleaf shell window it errors and reports that there is no such program as hcicmd – Obviously there is.

      This is on Cloverleaf 5.3 on Windows 2000 if it makes a difference.

      Am I being too clever or have I missed something?

      Thanks as always for any assistance with this.

      Garry

    Viewing 6 reply threads
    • Author
      Replies
      • #60343
        garry r fisher
        Participant

          ** UPDATE **

          Hi,

          I’ve made some progress but I still have a problem. By adding the full path to hcicmd I can now get it to run – Unfortunately I now get a different error about ‘invalid arguments’. I think this is because exec sees the -p $proc -c “$thread pstop” as a single argument (See Ousterhout p 114). I can’t seem to figure out the syntax to get this to work so again any help would be appreciated.

          If I manage to resolve this myself I’ll post another update.

          Garry

        • #60344
          Steve Carter
          Participant

            Try adding the — after the exec command.  I think it’s trying to interpret the dashes in the hcicmd command as switches for the exec.

            exec — hcicmd -p $processName -c “$threadName pstop”

            Hope this works for you.

            Steve

          • #60345
            garry r fisher
            Participant

              Sorry Steve,

              A good thought but that hasn’t sorted it – Still getting ‘invalid argument’.

              Garry

            • #60346
              Steve Carter
              Participant

                Must be Windows then… 🙂

                Here’s the exact code from a package that I use on AIX.  It works just fine for me.

                Steve

                ###################################

                proc threadStop {processName threadName} {

                   catch { exec — hcicmd -p $processName -c “$threadName pstop” } outPut

                   if { ([string match {*pstop issued*} $outPut]) || ([string match {*Thread is

                not running*} $outPut]) } {

                       return 1

                   } elseif { [string match {*No response within timeout*} $outPut] } {

                       return 0

                   } else {

                       return 0

                   }

                }

              • #60347
                garry r fisher
                Participant

                  Steve,

                  Just used your code in my script and it still doesn’t work – So I think I agree – its a Windows thing!!

                  Anybody else know a workround for this please?

                  Garry

                • #60348
                  Debra Downs
                  Participant

                    Gary,

                    I’m doing something similar, only using batch files.  See if ‘hcicmdnt’ will work for you.

                    Debbie

                  • #60349
                    garry r fisher
                    Participant

                      Hi Debbie,

                      Thanks – That works a treat. I simply replaced the hcicmd with hcicmdnt in my script – I can (hopefully) now carry on and do what I want to do now purely in Tcl.

                      Regards

                      Garry

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