[ Next Article |
Previous Article |
Book Contents |
Library Home |
Legal |
Search ]
General Programming Concepts: Writing and Debugging Programs
Adding Tasks to the SMIT Database
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.
Procedure
To create a test database, do the following:
- Create a directory for testing use. For example, the following command creates a
/home/smit/test directory:
mkdir /home/smit /home/smit/test
- Make the test directory the current directory:
cd /home/smit/test
- Define the test directory as the default object repository by setting the
ODMDIR environment variable to . (the current directory):
export ODMDIR=
- Create a new SMIT database in the test directory:
cp /etc/objrepos/sm_* $ODMDIR
To add tasks to the SMIT database:
- Design the dialog for the command
you want SMIT to build.
- 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. 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 next step.
- 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_stanzas:
odmadd test_stanzas
- Test and debug your additions by running SMIT using the local test database:
smit -o
"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 /usr/lib/objrepos:
export ODMDIR=/usr/lib/objrepos
Related Information
System Management Interface Tool (SMIT)
Overview for Programmers
For more information about programming SMIT, see Understanding SMIT Screen Types
,
Understanding SMIT Object Classes
, Understanding SMIT Aliases and FastPaths
, Understanding SMIT
Information Command Descriptors
, and Understanding SMIT Command Generation and Execution
.
Debugging SMIT
Database Extensions
and Creating SMIT Help Information for a NewTask
Message Facility
Overview for Programming
for information on how to create a message
file
odmadd command, odmcreate command, odmget command, smit command
[ Next Article |
Previous Article |
Book Contents |
Library Home |
Legal |
Search ]