AIX 5.3 ksh Scripting

Hi,

I posted a request for sever OS types earlier, but got no response. In an attempt to at least have a starting point, I think scaling it to one OS is preferred. Once I see the gist of it I can modify to account for different cases.

I need a script that will go and check to see if an LDAP connection is open and functioning. Just want to check with one LDAP user account,. i.e. lsldap - a passwd <ldap_username>

Need to output this to a file, in list format, for all that pass and a different file for those that do not. Can anyone please assist? It would be much appreciated, my boss is a cool guy but he needs this from me today if possible. I have searched the forums and am coming up empty on this.

Thanks in advance for any help you can provide,

D

AIX 5.3 is old. It drops off the support matrix 30 April 2012.
People here often prefer to try a command before posting.

LDAP with AIX is mentioned sometimes on this board but you may need to look at the provider of your LDAP service for specific queries.

Judging from the syntax in a much later AIX manual, there may be an extra space character in your command:

lsldap -a passwd <ldap_username>
1 Like

The LDAP is a Sun LDAP directory, nothing fancy, just a single directory server for POC purposes. This test will be run against machines in the DC to verify that they can connect/bind successfully, then output to one of two lists, (i.e.bind=yes, then output to bind.xml, bind=no, then output to nobind.xml), and nothing more.

I can check this individually using lsldap - a passwd <LDAP_USER>, on a machine that has it's ldap.cfg file configured correctly. My question is can this be scripted to run and see if certain machines are configured and can bind to that server also.

---------- Post updated at 01:17 PM ---------- Previous update was at 12:39 PM ----------

You're correct, there's not supposed to be a space. I typed it freehand, no paste lol...

For clarity, yes, this command works fine. If the machine is connected to the ldap directory where the user I choose to inout resides, then it will return the DN and other info.

My need goes beyond the command....I need a script that will check OS, run the lsldap command if AIX 5.3 or 6.1, if result returns correctly, then list machine in the proper xml. If not, then list machine in the other xml. Another script (that I am not responsible for) will come and vacuum up these xml files later and include them in a much bigger list. It's just looking for one of two possible filenames on my end.

The LDAP user, LDAP directory, and xml files are really extraneous. I just need a script that I can edit to input a user on the LDAP directory that I know is there, edit the xml out filenames, and will just go and check if the user exists then output that machine name to a yes or no xml. Hopefully I made sense ; )

Thanks you,

D