Updating a Directory with a Batch Process

 < Day Day Up > 



We have been typing commands using the command-line tool. This has two drawbacks: the risk of typos and the lack of documentation showing what you typed in. Fortunately, the ldapmodify command also accepts a file as input. Exhibit 9 shows what this file looks like. You will recognize the same input as you gave at the command line. Exhibit 10 shows the messages confirming execution of the file in Exhibit 9.

start figure

 # cat Persons.ldif dn: uid=TKlein, ou=Mkt, o=ldap_abc.de objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson cn: Thomas Klein sn: Klein givenName: Thomas ou: Mkt uid: TKlein mail: ThomasKlein@ldap_abc.de dn: uid=PSmith, ou=Mkt, o=ldap_abc.de objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson cn: Peter Smith sn: Smith givenName: Peter ou: Mkt uid: PSmith mail: PeterSmith@ldap_abc.de 

end figure

Exhibit 9: Input File for Idapmodify

start figure

 ldapmodify -a -D "uid=admin, o=ldap_abc.de" -w "pass1" -f Persons.ldif adding new entry "uid=TKlein, ou=Mkt, o=ldap_abc.de" adding new entry "uid=PSmith, ou=Mkt, o=ldap_abc.de" 

end figure

Exhibit 10: Execution of Idapmodify with Input from a File

Until now, we have used ldapmodify only in an interactive mode. Now that we know how to insert the data and instructions from a file, there is no need to use a command line to communicate with ldapmodify. Use Control-C to stop reading input from the prompt.

So far, we have learned that the directory is made up of a hierarchical tree of objects. We have seen that the position of a single object is given by its distinguished name (DN), which must he unique inside the directory. We have also seen that the distinguished name is constructed from the distinguished name of its ancestor plus its own relative distinguished name (RDN). Further, we have learned how to add entries and how to search in the directory. Finally, we have seen that instead of manually typing command-line entries, we can instruct ldapmodify to take its input from a file instead of from the command line. In the next section, we will see that ldapmodify has other functions beyond adding entries.



 < Day Day Up > 



The ABCs of LDAP. How to Install, Run, and Administer LDAP Services
The ABCs of LDAP: How to Install, Run, and Administer LDAP Services
ISBN: 0849313465
EAN: 2147483647
Year: 2003
Pages: 149

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net