COMPANY CONFIDENTIAL
12
2.2.2.2 Command Line Usage
The cgiMain program also has command line switches available for use in scripts. This provides convenient access to
stored parameter data, and data updated via web pages. In fact, a web page can start a script as part of a CGI interface,
where the script executes command line versions of cgiMain within the script to perform various functions.
Note that the cache file takes precedence over the flash contents when executing scripts. This is to allow changes to be
made and executed on a temporary basis, and only kept if the desired configuration operates satisfactorily. If you want
to discard cache change, they either ALL have to be discarded, or specific parameters removed. See adding, deleting,
committing, and invalidating cache.
In order to avoid putting
/usr/www/cgi-bin
into the execution path, a soft link from
/bin/cfg
to
/usr/www/cgi-bin/cgiMain
can be made. All following examples assume the system is configured in this manner. The
basic command line format is as follows:
#cfg [option] [option parameter]
2.2.2.2.1 Adding/modifying a variable in the cache file
To add a variable/value pair to the cache, use the following form:
#cfg –a VAR=VALUE
The variable name must not include spaces, and if the value includes spaces they must be “escaped” (\<char>) or the
value enclosed in quotes (“val”).
2.2.2.2.2 Deleting (removing) a value from the cache file
To delete a variable/value pair from the cache, use the following form:
#cfg –r VAR
The variable name must not include spaces. If the variable does not exist, no error is generated, but no action is
preformed on the cache file. If you remove a variable from the cache file, but do not commit the cache, it will remain in
the permanent flash storage and will be defined upon next bootup.
2.2.2.2.3 Committing the cache file to flash
To commit the contents of the cache file to flash, use the following form:
#cfg –c
This copies the entire contents of the cache file to flash. These values will be preserved through boot and power cycles.
2.2.2.2.4 Invalidating the cache file
In order to invalidate the cache file (re-read it from flash), use the following form:
#cfg –i
This re-reads the contents of the flash and overwrites the cache file with the flash values. This effectively eliminates any
changes made to the cache file without saving them to flash. Use with caution.
2.2.2.2.5 Translating a file
In order to translate a tagged file into a file with values inserted, use the following form:
#cfg –t<index> <filename>
This performs the translation as defined above. Note that the output is put to stdout, so it must be redirected to the
desired destination. The index argument on the option indicates the index value to use for variables with the “#” tag. An
example of usage:
#cfg –t2 /etc/wpa2/open_bss.ap > /tmp/sec2.cfg
This will translate the file /etc/wpa2/openbss.ap, inserting tags and using the value of “_2” as the substation for “#” tags,
and output the file to /tmp/sec2.cfg. The original file is not affected.