Check LDAP avaibility regulary based from Linux

in some situation I had to check/validate if some services/protocol were still available from a remote machine.

Add this script into your crontab and schedule it as needed.

Review the IP

#!/bin/sh
### IP Server LDAP 192.168.1.100
ldapsearch -x -h 192.168.1.100 -b ” -p 389 -s base > /dev/null
# echo $?
if [ $? = “0” ]; then echo “$(date) – Connection OK” >> /tmp/ldap_con.log
else echo “$(date) – Connection NOT OK” >> /tmp/ldap_con.log
fi
#—-

Leave a Reply