Last active
March 7, 2023 23:06
-
-
Save jdiverp/6c127f863baf81cb46610635536b8753 to your computer and use it in GitHub Desktop.
check all 5 stilpos
This file contains hidden or 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 | |
| HOSTBASE=stilpo31 | |
| HOSTLIST='stilpo32 stilpo33 stilpo34 stilpo35 stilpo36 stilpo37' | |
| export LDAPRC=.ldaprc_grp | |
| export HOME=~pass | |
| LDAPSEARCH='/usr/bin/ldapsearch -Q -LLL -o ldif-wrap=no' | |
| SEARCH="$1 $2 $3" | |
| echo ldapsearch $SEARCH | |
| TEMP_BASEFILE=/tmp/'.compareldapsearch_'$HOSTBASE'_'$$ | |
| $LDAPSEARCH -H ldaps://$HOSTBASE.s.uw.edu $SEARCH|sort > $TEMP_BASEFILE | |
| for host in $HOSTLIST; do | |
| TEMP_TARGET2=/tmp/'.compareldapsearch_'$host'_'$$ | |
| $LDAPSEARCH -H ldaps://$host.s.uw.edu $SEARCH|sort > $TEMP_TARGET2 | |
| COMP=`diff <(cat $TEMP_BASEFILE) <(cat $TEMP_TARGET2)` | |
| RESULT=$? | |
| if [ $RESULT -eq 0 ]; then | |
| echo $HOSTBASE and $host match | |
| else | |
| echo $HOSTBASE and $host differ: | |
| diff <(cat $TEMP_BASEFILE) <(cat $TEMP_TARGET2) | |
| echo | |
| fi | |
| rm -f $TEMP_TARGET2 | |
| done | |
| rm -f $TEMP_BASEFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment