D-Link NetDefendOS User Manual page 60

Network security firewall
Hide thumbs Also See for NetDefendOS:
Table of Contents

Advertisement

Chapter 2: Management and Maintenance
To run this script file after uploading, the CLI command would be:
gw-world:/> 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"
Escaping Characters
Sometimes, there is a requirement to escape certain characters in a command so they are treated
as ordinary characters when the command is executed. This is particularly true for the dollar-sign
"$" character. Consider the string: "te$t". In order to have the dollar-sign treated as a normal
character, it can be escaped in the normal way by using a backslash "\" character. The string
would become "te\$t" and the dollar-sign is no longer treated as special.
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:
gw-world:/> 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:
gw-world:/> script -execute -name=my_script2.sgs -verbose
Saving Scripts
When a script file is uploaded to the NetDefend Firewall, it is initially kept only in temporary RAM
memory. If NetDefendOS 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 NetDefendOS disk memory by using the script -store command.
60

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents