Running the program displays on the screen, as shown in the following
code example.
Example 9-9 NIS+ Program Execution
myhost% domainname
sun.com
myhost% ./sample
Adding Directory foo.sun.com. to namespace ...
Adding Directory groups_dir.foo.sun.com. to namespace ...
Adding Directory org_dir.foo.sun.com. to namespace ...
Adding admins.foo.sun.com. group to namespace ...
Adding principal myhost.sun.com. to group admins.foo.sun.com. ...
Creating table test_table.org_dir.foo.sun.com. ...
Adding entries to table ...
Group admins.foo.sun.com. membership is:
myhost.sun.com.
Contents of Directory foo.sun.com. are:
groups_dir
org_dir
Contents of Table test_table.org_dir.foo.sun.com. are:
Id. Name
--- ----
1 John
2 Mary
Entry corresponding to id 1 is:
1 John
Starting to Clean up ...
Removing principal myhost.sun.com. from group admins.foo.sun.com.
Removing admins.foo.sun.com. group from namespace ...
Deleting all entries from table test_table.org_dir.foo.sun.com. ...
Deleting table test_table.org_dir.foo.sun.com. itself ...
Removing groups_dir.foo.sun.com. directory object from namespace ...
Removing org_dir.foo.sun.com. directory object from namespace ...
Removing foo.sun.com. directory object from namespace ...
myhost%
|
As a debugging aid, the same operations are performed by the following
command sequence. The first command displays the name of the master server.
Substitute the master server name where the variable master appears in the following.
% nismkdir -m master foo.`domainname`.
# Create the org_dir.foo subdirectory with the specified master
% nismkdir -m master org_dir.foo.`domainname`.
# Create the groups_dir.foo subdirectory with the specified master
% nismkdir -m master groups_dir.foo.`domainname`.
# Create the "admins" group
% nisgrpadm -c admins.foo.`domainname`.
# Add yourself as a member of this group
% nisgrpadm -a admins.foo.`domainname`. `nisdefaults -p`
# Create a test_table with two columns : Id and Name
% nistbladm -c test_data id=SI Name=SI \
test_table.org_dir.foo.`domainname`
# Add one entry to that table.
% nistbladm -a id=1 Name=John test_table.org_dir.foo.`domainname`.
# Add another entry to that table.
% nistbladm -a id=2 Name=Mary test_table.org_dir.foo.`domainname`.
# List the members of the group admins
% nisgrpadm -l admins.foo.`domainname`.
# List the contents of the foo directory
% nisls foo.`domainname`.
# List the contents of the test_table along with its header
% niscat -h test_table.org_dir.foo.`domainname`.
# Get the entry from the test_table where id = 1
% nismatch id=1 test_table.org_dir.foo.`domainname`.
# Delete all we created.
# First, delete yourself from the admins group
% nisgrpadm -r admins.foo.`domainname`. `nisdefaults -p`
# Delete the admins group
% nisgrpadm -d admins.foo.`domainname`.
# Delete all the entries from the test_table
% nistbladm -r "[],test_table.org_dir.foo.`domainname`."
# Delete the test_table itself.
% nistbladm -d test_table.org_dir.foo.`domainname`.
# Delete all three directories that we created
% nisrmdir groups_dir.foo.`domainname`.
% nisrmdir org_dir.foo.`domainname`.
% nisrmdir foo.`domainname`.
|