The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 08-31-2008
rajamohan rajamohan is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 10
for file in $FILES
do
echo "About to Retrieve $file from $SOU$SRDIR"
echo "via $proxy"
err=1
cnt =1
while [ $cnt -le 4 ]
do
ssh -x $proxy ftp "$SOU$SRDIR$file"
err=$?
if [ "$err" != 0 ]
then
echo "File transfer failed. Bummer. $err"
echo "Trying again in 15 minutes"
sleep 900
cnt=`expr $cnt + 1`
else
break;
fi
done

echo " Retrieving file $file ..."
scp -p $proxy:~/$file .
chmod 666 $file
ls -l $file
ssh -x $proxy rm $file
done