OUD – Script to check replication delay



#!/bin/bash

CMD="dsreplication --advanced status --hostname localhost --port 4444 --adminUID admin --adminPasswordFile /tmp/pwd.txt --trustAll --no-prompt -b cn=oraclecontext,dc=example,dc=com --dataToDisplay missing-changes"

if [[ "$($CMD | awk /4444/'{ print $3 }')" -gt 0 ]]; then
  echo " ==  Delay in Replication == "
  echo " == Please execute the following command for detailed replication status =="
  echo "dsreplication status --hostname localhost --port 4444 --adminUID admin --adminPasswordFile ~/pwd.txt --trustAll --no-prompt"
fi

 

OUD – Monitor OUD Process

# Run the following script to monitor OUD LDAP Process Status

#!/bin/bash
LDAP_HOST=localhost
LDAP_PORT=4389
POOLING_INTERVAL=5
LOGFILE=/tmp/ldap_watchdog.log

#

echo "Watchdog started at `date`" >> $LOGFILE

while `/bin/true`; do
         ldapsearch  -h $LDAP_HOST -p $LDAP_PORT -D 'cn=directory manager' -w Welcome1 -b dc=example,dc=com -s base objectclass=* cn
        if [ $? -ne 0 ]; then
                echo "`date`: Could not establish connection to LDAP server" >> $LOGFILE
        fi
        sleep $POOLING_INTERVAL
done