Hi,
I have a requirement for creating a Perl Script which will perform Data Import process in an automated way and I am elaborating herewith :
Section 1 )
- use the following command line format :
"./import.pl -h hostname -p port -f datafile.txt"
Section 2)
datafile.txt will contain data in LDAP format something like this :
dn: ou=CA, ou=abc, o=com
objectClass: top
objectClass: organizationalUnit
-----
----
Section 3)
# Perl script should be defined to include four commands as mentioned below, I am just looking out for format as I will using my own command as per the need.
1) (Command 1)First search should be made to find the first line having dn: and then pull value "CA" from ou=CA. Note: "dn:" may appear in subsequent lines as well but we should only be concerned about the first one.
2) (Command 2) The CA value will be used in a ldapsearch command to check whether the values exist in the database, if Yes.
3) (Command 3) Peform the second ldapmodify command to delete the ou=CA from the database.
4) (Command 4) once done, import the datafile.txt using ldapmodify command.
I believe you people can provide me some sample steps to accomplish this.
Regards,
Scott