Phillip Wu · Sep 20

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
0 92
Discussion (4)2
Log in or sign up to continue

You may use input redirection as you find it in almost all Dockerfile installations:

RUN iris start IRIS \
    && iris session IRIS < iris.script \
    && iris stop IRIS quietly 

and iris.script (as example)

zn "%SYS"
Do ##class(Security.Users).UnExpireUserPasswords("*")
zn "USER"


something like this works for me

echo "h" | iris session [instance] -U [namespace] [routine]

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.

Thanks to ALL for your great suggestions - helped a great deal