Dears,
While executing the below script im getting the error at line 30. Please let me know what changes to be done to fix this.
test.sh: line 30: syntax error near unexpected token `done'
test.sh: line 30: ` done '
#!/bin/sh
# Rev. PA1
# author: eillops
# date: 26-04-2018
#
# Script to import the AUC/HLR/MNP data into Testlab CUDB with Slapadd and ldapadd
#! /usr/bin/awk -f
#!/bin/bash
sed -n '/dn: serv=AAA,mscId=/,/^\s*$/p' full.ldif > temp ; sed -n '/,ou=multiSCs,dc=btc/,/^\s*$/p' temp > serv_AAA_DS.ldif ; rm temp
if [[ -f "serv_AAA_DS.ldif" && -s "serv_AAA_DS.ldif" ]]; then
echo -e "serv_AAA_DS.ldif file created and will be splitted into 8 smaller files for ldapadd"
awk '
NR == 1 {("stat -c%s " FILENAME) | getline SZ
SZ /= 8
FN = FILENAME "_" ++c;
}
{if (CNT > SZ) {if (FN) close(FN)
FN = FILENAME "_" ++c;
CNT = 0
}
CNT += length
print $0 ORS > FN
}
' RS= serv_AAA_DS.ldif
for (( w=1; w <= 8; ++w ))
do
#$nohup ldapadd -x -c -h PL0 -p 389 -D "$LDAP_USER" -w $LDAP_PWD -f serv_AAA_DS.ldif_$w > serv_AAA_DS.ldif_$w.log 2>&1 &
done
wait
echo -e "#####################################################"
serv_AAA_DS_count=`cat serv_AAA_DS.ldif | grep '^dn: ' | wc -l`
echo -e "Count of serv AAA DS entry in Input : $serv_AAA_DS_count"
serv_AAA_DS_count_load=`cat serv_AAA_DS.ldif_*.log | grep 'adding new entry' | wc -l`
serv_AAA_DS_count_fail=`cat serv_AAA_DS.ldif_*.log | egrep -v "adding new entry|^$|No such file or directory" | wc -l`
echo -e "Count of serv AAA DS imported : $serv_AAA_DS_count_load"
echo -e "Count of serv AAA DS Failed : $serv_AAA_DS_count_fail"
echo -e "#####################################################"
echo -e "If failure count is not (0), cross-check the serv_AAA_DS.ldif_*.log\n"
else
echo -e "serv_AAA_DS.ldif is empty and will be removed \n"
rm serv_AAA_DS.ldif
fi
Thanks in advance.