Skip to content

Instantly share code, notes, and snippets.

@mlbiam
Created February 20, 2022 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlbiam/822b9016122a0ccb77609437f11eb249 to your computer and use it in GitHub Desktop.
Save mlbiam/822b9016122a0ccb77609437f11eb249 to your computer and use it in GitHub Desktop.
ldap_check_alive.sh
#!/bin/bash
USER_DN="cn=ou_svc_account,ou=Users,DC=sub,DC=domain,DC=com"
USER_PASSWORD="start123"
PORT="10983"
if ! $(ldapsearch -x -D $USER_DN -w $USER_PASSWORD -b $USER_DN -s base -H ldap://127.0.0.1:$PORT/ -l 10 > /dev/null ) ; then
echo "failed"
# hard kill
kill -9 $(ps -A | grep java | awk '{print $1}')
# start myvd
systemctl start myvd
else
echo "success"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment