iTP Secure WebServer System Administrator's Guide (iTPWebSvr 6.0+)

Tool Command Language (Tcl) Basics
iTP Secure WebServer System Administrator’s Guide523346-002
E-4
Script Commands
Script
A command argument can be an embedded Tcl script. A Tcl script argument is
always delimited with curly braces.
Tcl script arguments can be nested, as in the following example. Several of the iTP
Secure WebServer command procedures (configuration directives) use Tcl script
arguments. Tcl script arguments are also used extensively in the Tcl looping and
branching procedures. For example:
Region / {
if [HostMatch *.widget.com] {
Redirect /widget-welcome.html
}
}
Variable
There are two kinds of variables in Tcl: scalar variables and associative arrays.
These variables store assigned values that can be referenced in subsequent
commands.
You assign values to Tcl variables with the set command. For example, the
command
set root /usr/tandem/webserver
assigns the value /usr/tandem/webserver to the variable root.
Once a variable is set with a value, you can reference this value later in a Tcl script
by prefixing the variable name with a dollar sign ($). Referencing a variable in this
way is called variable substitution. For example, if the variable root currently
holds the value assigned by the set command immediately above, then the
reference to root in the command (configuration directive)
ExtendedLog $root/logs/httpd.log
is replaced by the current value of root, which is /usr/local/httpd. As a result, the
ExtendedLog configuration directive specifies the path:
/usr/tandem/webserver/logs/httpd.log
Script Commands
This section describes Tcl core commands that are commonly used in writing
configuration scripts for the iTP Secure WebServer:
pid
The pid command returns the numeric process ID of the server startup process.
This ID is useful for composing unique file names for configuration files or log
scripts. Note that the process ID returned by this command may not be the same
as the ID for the server daemon process. See Appendix A, Configuration
Directives.