[ Previous | Next | Table of Contents | Index | Library Home |
General Programming Concepts: Writing and Debugging Programs
When developing new objects for
the System Management Interface Tool (SMIT) database, it is recommended that
you set up a separate test database for development.
To create a test database, do the
- Create a directory for testing
use. For example, the following command creates a
mkdir /home/smit /home/smit/test
- Make the test directory the
- Define the test directory as
the default object repository by setting the ODMDIR environment
variable to . (the current directory):
- Create a new SMIT database in
the test directory:
cp /etc/objrepos/sm_* $ODMDIR
To add tasks to the SMIT
- Design the dialog for the
command you want SMIT to build. See Dialog Screens for more information.
- Design the hierarchy of menus
and, optionally, of selectors needed to get a SMIT user to the dialog, and
determine where and how this hierarchy should be linked into the existing SMIT
database. See Menu Screens and Selector Screens for more information. The following
strategy may save you time if you are developing SMIT database extensions for
the first time:
- Start SMIT (run the smit command), look for existing menu, selector,
and dialog screens that perform tasks similar to the one you want to add, and
find the menu screen(s) to which you will add the new task.
- Exit from SMIT, then remove
the existing SMIT log file. Instead of removing the log file, you can
use the -l flag of the smit command to specify a
different log file when starting SMIT in the following step. This
enables you to isolate the trace output of your next SMIT session.
- Start SMIT again with the
-t command flags and again look at the screen to which you will add
the new task. This logs the object IDs accessed for each screen for the
- Look at the SMIT log file to
determine the ID for each object class used as part of the menu(s).
- Use the object class IDs with
the odmget command to retrieve the stanzas for
these objects. The stanzas can be used as rough examples to guide your
implementation and to learn from the experience of others.
- Look in the SMIT log file for
the command strings used when running through the screens to see if special
tools are being utilized (such as sed or awk scripts,
ksh shell functions, environment variable assignment, and so
on). When entering command strings, keep in mind that they are
processed twice: the first time by the odmadd command and the second time by the
ksh shell. Be careful when using special escape
meta-characters such as \ or quotation characters
(' and "). Note also that the output of the
odmget command does not always match the input to the
odmadd command, especially when these characters or multiline
string values are used.
- Code the dialog, menu, and
selector objects by defining them in the ASCII object stanza file format
required by the odmadd command. For
examples of stanzas used to code SMIT objects, see SMIT Screen Types .
- Add the dialog, menu, and
selector objects to the SMIT test database with the odmadd command,
using the name of your ASCII object stanza file in place of
- Test and debug your additions
by running SMIT using the local test database:
Debugging SMIT Database Extensions discusses how to test and debug additions to SMIT.
When you are finished testing,
restore the /usr/lib/objrepos directory as the default object
repository by setting the ODMDIR environment variable to
Chapter 25, System Management Interface Tool (SMIT)
SMIT Screen Types , SMIT Object Classes , SMIT Aliases and Fast Paths , SMIT Information Command Descriptors , and SMIT Command Generation and Execution
Debugging SMIT Database Extensions and Creating SMIT Help Information for a New Task
Message Facility Overview for Programming for information on how to create a message file
odmadd command, odmcreate command, odmget command, smit command
[ Previous | Next | Table of Contents | Index |
Library Home |