D-Link DFL-1660 User Manual page 46

Network security firewall
Hide thumbs Also See for DFL-1660:
Table of Contents

Advertisement

2.1.5. CLI Scripts
Only Four Commands are Allowed in Scripts
The commands allowed in a script file are limited to four and these are:
add
set
delete
cc
If any other command appears in a script file, it is ignored during execution and a warning message
is output. For example, the ping command will be ignored.
Executing Scripts
As mentioned above, the script -execute command launches a named script file that has been
previously uploaded to the NetDefend Firewall. For example, to execute the script file my_script.sgs
which has already been uploaded, the CLI command would be:
gw-world:/> script -execute -name=my_script.sgs
Script Variables
A script file can contain any number of script variables which are called:
$1, $2, $3, $4......$n
The values substituted for these variable names are specified as a list at the end of the script -execute
command line. The number n in the variable name indicates the variable value's position in this list.
$1 comes first, $2 comes second and so on.
For example, a script called my_script.sgs is to be executed with IP address 126.12.11.01 replacing
all occurrences of $1 in the script file and the string If1 address replacing all occurrences of $2.
The file my_script.sgs contains the single CLI command line:
add IP4Address If1_ip Address=$1 Comments=$2
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"
Note
Uploaded CLI script files are not held in permanent memory and will disappear after
system restarts.
Note: The symbol $0 is reserved
Notice that the name of the first variable is $1. The variable $0 is reserved and is
always replaced before execution by the name of the script file itself.
Chapter 2. Management and Maintenance
46

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dfl-2560Dfl-2560gDfl-260eDfl-860e

Table of Contents