UPoC Issue when Executing cmd Script

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf UPoC Issue when Executing cmd Script

  • Creator
    Topic
  • #55643
    Tom Righele
    Participant

      Hello all!

      I am running into the strangest issue when running a UPoC.

      I have a tcl script that executes a cmd file. The cmd file runs a command that first sets the site.

      For some reason, when I run through the testing tool, the script works perfectly. When I run through the UPoC, the setsite function seems to not work at all and it’s stuck on the mastersite.

      Any advice? I’ve tried a  bunch of different things.

      Thanks guys!! 8)

    Viewing 7 reply threads
    • Author
      Replies
      • #85993
        Charlie Bursell
        Participant

          It is a security issue and therefore a child process is not allowed to change the environment of the parent process.  Look at this:

          https://stackoverflow.com/questions/26068162/tcl-setting-parent-environment-variables-within-script

          You could try sourcing the child script.  I haven

        • #85994
          Rob Lindsey
          Participant

            Not that I am trying to dissuade you from going down this path but what exactly does the cmd script do that you cannot do in TCL or adding more information to the cmd script to handle your situation?

            Some of us may have been down this road, can you provide more information so that we might be able give you some help.

            Rob

          • #85995
            Tom Righele
            Participant

              Thank you all for your input. I am going to try some of these things later on tonight.

              First, let me preface this with what we are running. We are on 6.1.2.3 and running in Windows OS.

              The goal of this script is to output statistics to folder in a csv format so another thread can grab these files and store them to a sql db.

              In the usercmds folder under the root directory, I have two scripts. Transactioncountcycle.cmd and trans_to_file.tcl. The trans_to_file uses msiAttach to gather statistics for the current site you are on, and outputs to a csv. The Transactioncountcycle.cmd sets each site and runs the trans_to_file for each one. I had to do this because you cannot change sites when you use msiAttach in a single proc.

              I have this UPoC that executes the Transactioncountcycle.cmd in our maintenance site, and whenever it’s run, it ignores the setsite command and runs the trans_to_file only fo the maintenance site. I am guessing that since the site the UPoC is on is considered the “parent environment” and it will not take change the sites based off child proc.

              I am fortunate to also be attending Cloverleaf Intermediate class (with James D.) and the he advised that I could run a scheduled task to simply run the Transactioncountcycle.cmd. This should work and it is something I will try tonight. Props to James!

              However, I would like to keep this all within Cloverleaf if possible, so if anyone has any other ideas, please let me know.

              P.S. We are ALSO migrating to Linux, so we have a TEST environment under that OS. I was able to get this to work there using a sh that basically does the same thing as the Transactioncountcycle.cmd

            • #85996
              Tom Righele
              Participant

                Hello all-

                Wanted to update everyone as I was able to fix my issue!

                I used the the below statement to change my site at the parent process:

                Code:


                if ![catch {netcfgLoad} err] {
                NCFG:ChangeSite $siteDir
                netcfgLoad
                }

                I cycled through all the sites that I wanted to run my scripts on and changed the site before I executed my script.

                Thank you  everyone for your input!

                Tom

              • #85997
                Charlie Bursell
                Participant

                  I am a bit confused.  I did not think the problem dealt with getting a list of sites but with how to setsite to a site in order to get the statistics for that site.

                  How are you doing that?

                  Many years ago, I wrote a utility, which may be in your contrib directory called listSites.  It simply reads the server.ini file without a need to load the NetConfig

                  It does additinal things like denoting the default and master site in its output list.  I have attached a copy if you like.  It will work just well on Unix by removing the .htc.

                  I would still like to know how you solved the statistics issue.

                • #85998
                  Charlie Bursell
                  Participant

                    No Attachment?

                  • #85999
                    Tom Righele
                    Participant

                      Sorry Charlie, I should have been a bit more clear with my initial post.

                      The main issue I was having is when I used a scheduled UPoC to exec a cmd script that changed sites and performed the statistics tcl.

                      Each site needs to be set prior to running the statistics tcl to get that site’s stats. When it was time for the UPoC to run, it would ignore the “setsite” command and stay on the site that I am running the scheduled UPoC on.

                      However, if I change the site on the tps on the schedules UPoC using the below code, I can then simply exec a cmd script that performs the statistics tcl.

                      If you are interested, I can post the code here later. Let me know!

                      -Tom  8)

                    • #86000
                      Charlie Bursell
                      Participant

                        Tom:

                        Thanks for the clarification.  I would like to see what you did as I am sure others would also.

                        Being retired, some say retarded, I am always looking for something to do to keep the brain cells active.

                        Thanks to some code posted by David Barr and Jeff Dinsmore, I have been able to do a rudimentary script that will cycle through all sites and read the stats of each using the hcicmd command.  A caveat is that hcimonitord must be running.

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