Created
February 20, 2022 15:47
-
-
Save mlbiam/822b9016122a0ccb77609437f11eb249 to your computer and use it in GitHub Desktop.
ldap_check_alive.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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