Heres is my code. It says Syntax error at line 44 : `fi' is not expected. Why?
#-------------------------------
# Put file to imaging ftp server.
#-------------------------------
{
rrfile=/tmp/tf2tiff
export prod_a=tf2tiff-vm
export prod_b=btf2tiff-vm
TIPFUP=$( /usr/sbin/ping $prod_a -n 2|awk '/received/{print $4}' )
BTIPFUP=$( /usr/sbin/ping $prod_b -n 2|awk '/received/{print $4}' )
if [[ $TIPFUP = 2 || $BTIPFUP = 2 ]]
then
echo "A file2tif is on"
# test if prod_a is up and rrfile exist
if [[ $TIPFUP = 2 && -a $rrfile ]]
then
echo " TF2TIFF is on"
echo "file /tmp/tf2tiff exist"
rm -f $rrfile
# check flag file if exist then process files and delete flag file
elif [[ $BTIPFUP = 2 ]]
then
echo "BTF2TIFF is on"
touch $rrfile
# check flag file if exist then process files and delete flag file
else
# ftp to $TIPFUP
# check flag file if exist then process files and delete flag file
fi
else
# store files locally
# create flag file
echo "No tf2tiff"
fi
} >> ${LOG} 2>&1
#-------------------------------
# Put file to imaging ftp server.
#-------------------------------
{
rrfile=/tmp/tf2tiff
export prod_a=tf2tiff-vm
export prod_b=btf2tiff-vm
TIPFUP=$( /usr/sbin/ping $prod_a -n 2|awk '/received/{print $4}' )
BTIPFUP=$( /usr/sbin/ping $prod_b -n 2|awk '/received/{print $4}' )
if [[ $TIPFUP = 2 || $BTIPFUP = 2 ]]
then
echo "A file2tif is on"
# test if prod_a is up and rrfile exist
if [[ $TIPFUP = 2 && -a $rrfile ]]
then
echo " TF2TIFF is on"
echo "file /tmp/tf2tiff exist"
rm -f $rrfile
# check flag file if exist then process files and delete flag file
elif [[ $BTIPFUP = 2 ]]
then
echo "BTF2TIFF is on"
touch $rrfile
# check flag file if exist then process files and delete flag file
else
# ftp to $TIPFUP
# check flag file if exist then process files and delete flag file
fi
else
# store files locally
# create flag file
echo "No tf2tiff"
fi
} >> ${LOG} 2>&1