· Sep 20, 2022

iris session [command line] get commands from a file

With iris session <instance>:

Is it possible to tell the program to read commands & other inputs from a file and when it reaches end of file

return control back to the physical terminal? 

Product version: IRIS 2022.1
Discussion (4)1
Log in or sign up to continue

Hi Phillip,

This can be done locally and depending on access, remotely also.

From a windows host running commands against a Linux Database can use a file for example: SC_ImportBase.txt

Could use os authentication but including credentials as an example for what is possible:

cd /tmp; sudo -u irisowner iris session Instance -U "USER" << EOF

zn "USER"
set schedule=##class(ompare.Schedule).%New()
set schedule.Environment="BASELABDB"
set schedule.Namespaces="APPONE,INTEG-*"
set schedule.RunSourceHandlers=0
set schedule.ExportToFile=0
set schedule.ExportDirectory="/home/irisowner/SourceCompare"
set schedule.ImportDirectory="/home/irisowner/SourceCompare"
set schedule.ImportFromFile=1
set schedule.ReImportUpdatedFiles=0
set schedule.DeleteImportedFiles=0
set schedule.RetainExportDays=1
set schedule.EnableLogging=0
set schedule.IncludeSourceCode=1
set schedule.RetainSigSrcHistoricVersions=-1
set schedule.BackupSourceCode=0
set schedule.Debug=1
set schedule.OverwriteSourceOnReLoad=1
Do:\$NAMESPACE="USER" schedule.OnTask()
W !,"Completed"

And can launch this script against a remote Linux instance using plink from a local batch file:

"%cmdPLINK%" -v account@10.123.456.789 -pw %LinuxPass% -m "%cmdBase%scr\SC_ImportBase.txt" > "%cmdBase%out\SC_ImportBasePlink.log"


cmdPLINK = C:\Program Files\PuTTY\plink.exe
LinuxPass = LinuxPass
cmdBase = Local Directory with source commands and for screen output log

Hope this gives some ideas.