Skip to content

Commit

Permalink
add summary
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Jul 17, 2025
1 parent 469fce7 commit 58c2222
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions local-app/bin/check-users.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cleanup()
}
trap cleanup EXIT

VERSION="1.1.0"
VERSION="1.1.1"
THIS=$(basename $0)
export TMPDIR=$(/bin/mktemp -d /tmp/check-users.XXXXXXXX) || (echo "#* error making TMPDIR" && exit 1)
#OUTFILE="$(basename $THIS .sh).$(date +%s).txt"
Expand All @@ -29,16 +29,22 @@ else
FILE=$1
fi

ts=$(date +%s)
c=0
no_mail_count=0
separated_count=0
for f in $(awk -F, 'NR>1 {print $1}' users.csv)
do
c=$(( c + 1 ))
/apps/terraform/bin/ldapsearch cn=$f dn employeeType mail loginDisabled > $OUTFILE
error=0
dn_exists=$(grep -c ^dn $OUTFILE)
mail=$(grep ^mail $OUTFILE|awk '{print $2}')
error=0
if [ -z "$mail" ]
then
has_mail=0
NO_MAIL+=" $f"
no_mail_count=$(( no_mail_count + 1 ))
error=$(( error + 1 ))
mail="(none)"
else
Expand All @@ -51,6 +57,7 @@ do
then
is_separated=1
IS_SEPARATED+=" $f"
separated_count=$(( separated_count + 1 ))
error=$(( error + 1 ))
else
is_separated=0
Expand All @@ -72,3 +79,6 @@ do
echo "$is_separated,$has_mail $f $et $logindisabled $mail"
fi
done
te=$(date +%s)
tx=$(( te - ts ))
echo "summary: records $c no_mail_count $no_mail_count separated_count $separated_count elapsed $tx"

0 comments on commit 58c2222

Please sign in to comment.