#!/bin/bash
batch=/home/user/test/test1
prod=/home/user/test/test2
echo -n "Enter DC FTP-1 Prod path: "
read ftpbatch
echo -n "Enter DC FTP-2 Prod path: "
read ftpprod
echo -n "Enter File name to campare : "
read file
export A=$ftpbatch
export B=$ftpprod
export C=$file
E=$(rm -rf $batch/$C* | rm -rf $batch/*)
F=$(rm -rf $prod/$C* | rm -rf $prod/*)
D=`wget -P $batch ftp://$server1$A/$C 2>&1 /tmp/ftp_wget_logs`
G=$(echo $?)
if [ 0 == "$G"]; then
echo "file has been download $batch/$C"
else
echo "file is not found ftp://$server1$A/$C"
exit 1
T=`wget -P $batch ftp://$server1$B/$C 2>&1 /tmp/ftp_wget_dest_logs`
H=$(echo $?)
if [ 0 == "$H"]; then
echo "file has been download $prod/$C"
else
echo "file is not found ftp://$server1$B/$C"
exit 1
I=$(cd $batch && wc -l $C)
J=$(cd $prod && wc -l $C)
# DD=$(sed "s/ /\\ /g" /tmp/ab) world me space hai to.
#$(cd $batch && wc -l "$DD")
H=$(cd $batch && du -sh $C | awk '{print $1}')
H=$(cd $prod && du -sh $C | awk '{print $1}')
cmd1=$(diff -u --ignore-all-space $batch/"$C" $prod/$"$C") sare space remove
cmd=$(diff --changed-group-format='%>%<' --unchanged-group-format='' $batch/$C $prod/$C)
Z=$(diff --changed-group-format='%>%<' --unchanged-group-format='' $batch/$C $prod/$C | wc -l)
if [ 0 == "$Z" ];then
cat << EOF > /home/user/test/diff_logs
===================================
"File-Name: $C ,File-Size : $H, TL: $I"
"File-Name: $C ,File-Size : $G, TL: $J"
"DIff is not found in both files."
==================================
EOF
else
cat << EOF > /home/user/test/diff_logs
"File-Name: $C ,File-Size : $H, TL: $I"
"File-Name: $C ,File-Size : $G, TL: $J"
$cmd
=====================================
EOF
fi
=============== close=============================================
diff contune
===============================================================
#!/bin/bash
batch=/home/user/test/test1
prod=/home/user/test/test2
A=$(ls -l $batch | awk '{print $9}' | sed 1d > /tmp/prod_ftp1)
B=$(ls -l $prod | awk '{print $9}' | sed 1d > /tmp/prod_ftp2)
C=`diff --changed-group-format='' --unchanged-group-format='%>' /tmp/prod_ftp1 /tmp/prod_ftp2`
D=`echo -n "$C" > /tmp/prod_ftp3`
total=${#files[*]}
for (( i=0; i<=$(( $total -1 )); i++ ))
do
echo -n "${files[$i]"
done
batch=/home/user/test/test1
prod=/home/user/test/test2
echo -n "Enter DC FTP-1 Prod path: "
read ftpbatch
echo -n "Enter DC FTP-2 Prod path: "
read ftpprod
echo -n "Enter File name to campare : "
read file
export A=$ftpbatch
export B=$ftpprod
export C=$file
E=$(rm -rf $batch/$C* | rm -rf $batch/*)
F=$(rm -rf $prod/$C* | rm -rf $prod/*)
D=`wget -P $batch ftp://$server1$A/$C 2>&1 /tmp/ftp_wget_logs`
G=$(echo $?)
if [ 0 == "$G"]; then
echo "file has been download $batch/$C"
else
echo "file is not found ftp://$server1$A/$C"
exit 1
T=`wget -P $batch ftp://$server1$B/$C 2>&1 /tmp/ftp_wget_dest_logs`
H=$(echo $?)
if [ 0 == "$H"]; then
echo "file has been download $prod/$C"
else
echo "file is not found ftp://$server1$B/$C"
exit 1
I=$(cd $batch && wc -l $C)
J=$(cd $prod && wc -l $C)
# DD=$(sed "s/ /\\ /g" /tmp/ab) world me space hai to.
#$(cd $batch && wc -l "$DD")
H=$(cd $batch && du -sh $C | awk '{print $1}')
H=$(cd $prod && du -sh $C | awk '{print $1}')
cmd1=$(diff -u --ignore-all-space $batch/"$C" $prod/$"$C") sare space remove
cmd=$(diff --changed-group-format='%>%<' --unchanged-group-format='' $batch/$C $prod/$C)
Z=$(diff --changed-group-format='%>%<' --unchanged-group-format='' $batch/$C $prod/$C | wc -l)
if [ 0 == "$Z" ];then
cat << EOF > /home/user/test/diff_logs
===================================
"File-Name: $C ,File-Size : $H, TL: $I"
"File-Name: $C ,File-Size : $G, TL: $J"
"DIff is not found in both files."
==================================
EOF
else
cat << EOF > /home/user/test/diff_logs
"File-Name: $C ,File-Size : $H, TL: $I"
"File-Name: $C ,File-Size : $G, TL: $J"
$cmd
=====================================
EOF
fi
=============== close=============================================
diff contune
===============================================================
#!/bin/bash
batch=/home/user/test/test1
prod=/home/user/test/test2
A=$(ls -l $batch | awk '{print $9}' | sed 1d > /tmp/prod_ftp1)
B=$(ls -l $prod | awk '{print $9}' | sed 1d > /tmp/prod_ftp2)
C=`diff --changed-group-format='' --unchanged-group-format='%>' /tmp/prod_ftp1 /tmp/prod_ftp2`
D=`echo -n "$C" > /tmp/prod_ftp3`
total=${#files[*]}
for (( i=0; i<=$(( $total -1 )); i++ ))
do
echo -n "${files[$i]"
done
No comments:
Post a Comment