beautypg.com

Amer Networks E5Web GUI User Manual

Page 52

background image

Device:/> script -execute -name=my_script.sgs 126.12.11.01 "If1 address"

When the script file runs, the variable replacement would mean that the file becomes:

add IP4Address If1_ip Address=126.12.11.01 Comments="If1 address"

Script Validation and Command Ordering

CLI scripts are not, by default, validated. This means that the written ordering of the script does
not matter. There can be a reference to a configuration object at the beginning of a script which
is only created at the end of the script.

Although this approach might seem illogical, it is done to improve the readability of scripts. If
something always has to be created before it is referred to then this can result in confused and
disjointed script files and in large script files it is often preferable to group together related CLI
commands.

Error Handling

If an executing CLI script file encounters an error condition, the default behavior is for the script
to terminate. This behavior can be overridden by using the -force option.

For example, to run a script file called my_script2.sgs in this way so that errors do not terminate
execution, the CLI command would be:

Device:/> script -execute -name=my_script2.sgs -force

If -force is used, the script will continue to execute even if errors are returned by a command in
the script file.

Script Output

Any output from script execution will appear at the CLI console. Normally this output only
consists of any error messages that occur during execution. To see the confirmation of each
command completing, the -verbose option should be used:

Device:/> script -execute -name=my_script2.sgs -verbose

Saving Scripts

When a script file is uploaded to the Clavister Security Gateway, it is initially kept only in
temporary RAM memory. If cOS Core restarts then any uploaded scripts will be lost from this
volatile memory and must be uploaded again to run. To store a script between restarts, it must
explicitly be moved to non-volatile cOS Core disk memory by using the script -store command.

For example, to move my_script.sgs to non-volatile memory, the command would be:

Device:/> script -store -name=my_script.sgs

Alternatively, all scripts can be moved to non-volatile memory with the command:

Device:/> script -store -all

Chapter 2: Management and Maintenance

52

This manual is related to the following products: