› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Automatically cycle smat files
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
Here are my cron entires:
[code]##
#
#
Russ Ross
RussRoss318@gmail.com
Where can I find the save_cycle procs?
Dave
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}
}
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
It contains the Windows as well as the Unix version.
Dirk
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
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
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
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
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
then come to the user group and visit your mom
Dirk
Dave
Ok im trying to use the scrpits available on the site to cycle my smat files automatically.
cmd /C C:quovadxcycleSMATcycleSMAT.bat med_adt AgiLink out
making sure that cycleSMAT.bat is called from the proper directy.
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
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
“
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.