Automatically cycle smat files

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Automatically cycle smat files

  • Creator
    Topic
  • #49241
    john benevento
    Participant

      Is there any way to automatically cycle smat files?  I currently cycle them manually each week, but if I forget they become too large to open.  (We’re running with 5.3P REV 2 Windows)  Thanks for any suggestions.

    Viewing 18 reply threads
    • Author
      Replies
      • #61210
        garry r fisher
        Participant

          Hi John,

          I use a batch file to run hcicmd along the lines of:

          call w:quovadxqdx5.3integratorsbinsetroot w:quovadxqdx5.3integrator production

          hcicmd -p OCM -c “LAB_CLINIRES_OUT save_cycle out”

          hcicmd -p OCM -c “CLINI_LABORD_OUT save_cycle out”

          And then use Windows Scheduler to run it every day. Remember to set the user to hciuser within Scheduler.

          Regards

          Garry

        • #61211
          Russ Ross
          Participant

            FYI – we have a naming convention for our SMAT files that are thread_name.out or thread_name.in!!!

            Here are my cron entires:

            #
            #
            [code]#
            #

            Russ Ross
            RussRoss318@gmail.com

          • #61212
            David Marquis
            Participant

              Hello,

              Where can I find the save_cycle procs?

              Dave

            • #61213
              David Marquis
              Participant

                Hello All,

                I am trying to get this script to work under Windows and here is the error I get when I manually run the backupSMAT via that tcl command line:

                C:quovadxqdx5.4integratorscripts>tcl backupSMAT.tcl

                Prozess

                Thread

                Content

                Error: can’t read “smat”: no such variable

                   while executing

                “keylget smat $filetype filename”

                   (file “backupSMAT.tcl” line 16)

                Any ideas? It seems that $smats isn’t set correctly.

                Dave

                Here is the code:


                # First, set the HciRootDir, HciSite and HciSiteDir variables.

                if [catch setHciDirs msg] {

                  puts stderr $msgn

                  exit 69

                }

                set args [split $argv]

                lassign $args process thread content

                echo Prozess $process

                echo Thread $thread

                echo Content $content

                set filetype [string toupper $content]FILE

                set threaddata [netconfig get connection data $thread]

                keylget threaddata SAVEMSGS smats

                keylget smats $filetype filename

                set idxfile $HciSiteDir/exec/processes/$process/$filename.old.idx

                set msgfile $HciSiteDir/exec/processes/$process/$filename.old.msg

                catch {file mkdir $HciSiteDir/exec/processes/$process/backup}

                if {[file exists $idxfile]} {

                set ts [clock format [file mtime $idxfile] -format %Y%m%d%H%M%S]

                set bakidx $HciSiteDir/exec/processes/$process/backup/$filename.$ts.idx

                set bakmsg $HciSiteDir/exec/processes/$process/backup/$filename.$ts.msg

                catch {file rename $idxfile $bakidx}

                catch {file rename $msgfile $bakmsg}

                }


              • #61214
                Charlie Bursell
                Participant

                  Weird   Tcl is seeing the command “keylget smat $filetype filename” while the script has “keylget smats $filetype filename”  It is not seeing the s at the end.  Something weird maybe when you entered it.  Just delete the line and re-enter to see what happens.

                • #61215
                  Dirk Engels
                  Participant

                    Hi David,

                    this is a little script I wrote to cycle SMAT files for our customers. The script would normally be called from a script called cycleSMAT.bat.

                    The script needs 3 parameters as described in the script itself:

                    rem ###################################################################################

                    rem cycleSMAT.bat

                    rem This script cycles a smat file and calls a tcl script which moves these cycled files

                    rem to a backup directory in the process working area. The “old” string in the smat file-

                    rem names will be replaced by the creating date of the smat file.

                    rem

                    rem These bat script can be called as a cron/at job or as action for an specific alert

                    rem with a time window.

                    rem

                    rem Syntax: cmd /C cycleSMAT.bat

                    rem

                    rem

                    call /quovadx/qdx5.3/integrator/sbin/setroot.cmd /quovadx/qdx5.3/integrator production

                    hcicmd -p %1 -c “%2 save_cycle %3” 1>nul: 2>&1

                    hcitcl /quovadx/scripts/backupSMAT.tcl %1 %2 %3 1>nul: 2>&1

                    You normally should use the cycleSMAT.bat script to cycle and then automatically move the files to a backup directory.

                    Greetings from Germany,

                    Dirk

                  • #61216
                    Dirk Engels
                    Participant

                      I’ve added the archiv with the scripts again.

                      It contains the Windows as well as the Unix version.

                      Dirk

                    • #61217
                      David Marquis
                      Participant

                        Thanks Dirk for your help! It seems to wirk, but where is it putting the backed up files?

                        I am running the following command:

                        C:Documents and Settingsadministrator.STPAULRADDesktop>cycleSMAT.bat orders to_ps in

                        Dave

                        Sorry my stupid. It it putting them in the same folder. How about appending the date onto the file?

                        Dave

                      • #61218
                        Dirk Engels
                        Participant

                          David,

                          the files will be move into a folder backup in the process directory. Also the string old will be replaced with a timestamp.

                          The processing order is:

                          1. cycle files

                          2. replace the .old. – string by a time stamp and

                          3. move it to the backup folder in the process directory.

                          Of course you can move them anywhere you like. Just change the pathname in the backupSMAT.tcl file.

                          Dirk

                        • #61219
                          David Marquis
                          Participant

                            Dirk Engels wrote:

                            David,

                            the files will be move into a folder backup in the process directory. Also the string old will be replaced with a timestamp.

                            The processing order is:

                            1. cycle files

                            2. replace the .old. – string by a time stamp and

                            3. move it to the backup folder in the process directory.

                            Of course you can move them anywhere you like. Just change the pathname in the backupSMAT.tcl file.

                            Dirk

                            Hi Dirk,

                            As the script is it won’t do #2 or #3. It will just over write the files with the filename.old.idx so I am a little confused as to why it doesn’t work. I can’t get it to copy the files to another location either if I modify the script path for the output.

                            Kind of a noob to TCL but not to other programming languages….

                            Dave

                          • #61220
                            Dirk Engels
                            Participant

                              David,

                              that curious.

                              Did you check that the backupSMAT.tcl file is in the directory written in the cycleSMAT.bat file or did you change the path?

                              What you should do is to erase the  “1>nul: 2>&1” attachment to the commands and execute them just in the shell to see possible error messages.

                              See you in Dallas soon?

                              Dirk

                            • #61221
                              David Marquis
                              Participant

                                Hi Dirk,

                                I will give that a try. Funny you mention Dallas as I have been there awhile back for class 1 training and I should probably head down for class 2. My mom also lives down there with some other family members and is always asking me to move down there as well.

                                Dave

                              • #61222
                                Dirk Engels
                                Participant

                                  David,

                                  then come to the user group and visit your mom 😀

                                  Dirk

                                • #61223
                                  David Marquis
                                  Participant

                                    Totally works as expect. Thanks!

                                    Dave

                                  • #61224
                                    Rick Pritchett
                                    Participant


                                      Ok im trying to use the scrpits available on the site to cycle my smat files automatically.

                                    • #61225
                                      Rick Pritchett
                                      Participant

                                        Ok im trying to use the scrpits available on the site to cycle my smat files automatically.  I have a site named test_med_01, a process named med_adt and a thread named AgiLink.

                                        cmd /C C:quovadxcycleSMATcycleSMAT.bat med_adt AgiLink out

                                        making sure that cycleSMAT.bat is called from the proper directy.

                                      • #61226
                                        Dirk Engels
                                        Participant

                                          Yes, that should work.

                                          The syntax is always “cycleSMAT.bat “.

                                          BTW, if someone needs to cycle SMATs in different sites I’ve also a version which sets the site first. The site is then another parameter in the call.

                                          Dirk

                                        • #61227
                                          Kirby Knight
                                          Participant

                                            When I try to execute the backupSmat.tcl.  I get the following error.

                                            Prozess {$1}

                                            Thread {$2}

                                            Content {$3}

                                            can’t read “smats”: no such variable

                                               while executing

                                            “keylget smats $filetype filename

                                          • #61228
                                            Dirk Engels
                                            Participant

                                              Hi Kirby,

                                              normally you should call the cycleSMAT.bat script with the 3 arguments (see previous post). Then it should work. The backupSMAT.tcl script will be executed from the script.

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