Run

Runs a batch file (script) of iWay commands. Any commands can be in the command file, however information issued may not be found. All commands are "evaluated" using the iWay Functional Language, using the special registers of the manager only.

As the server starts, it looks in the configuration root for a file autocmd.txt. If found, it runs this command file.

Within a command file, the goto <label> command is available to skip forward. Labels end with colons. A goto command can be the subject of an IFL if().

The special token $cmdstatus$ is replaced with the value of the command status from the prior command. To use this token, the cmdstatus feature must be enabled. See set command.

A run file can contain comments, which begin with // in any column.

_if( _now('E')='Tue',goto tuesday)
start (chan1, chan2)     // the non-tuesday channels
goto everyday   	
tuesday:
start chan_tues
_if($cmdstatus = 0),goto end)
say command to start channel chan-tues failed with status $cmdstatus
everyday:

The following is issued when performing a run command:

run <scriptpath [-trace] [-loop <count>] [-map pairs…] 

where:

scriptpath

Is the script to be run.

-t[race]

Is each line of the displayed scripted as it is executed.

-l[oop]<count>

Is the number of executions of each line. If the count exceeds the <count> value, the script is terminated. This is intended for prevent loops by uncontrolled GOTO’s. The default is 50. To eliminate the loop counting, set the count to zero (0).

-s[toponerrors]

If set, the script will terminate on any detected errors.

-map pairs

This must be the last switch/parameter on the command line. All tokens that follow it are considered as token=value pairs. The = sign and commas are optional. These token/value pairs are treated a script parameters. To include the value of a parameter on a line of the script, designate the token as $token$.

For example:

run  myscript.txt -map name=Weekday

The script might contain the line:

say Script is $name$

with the resultant message emitted:

Script is Weekday

The Start command offers the -doflow switch to cause a defined channel failure startup flow to execute if the channel fails to start. You may wish to consider this in your startup script.