The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 -->
  #4 (permalink)  
Old 08-31-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Or simply just

Code:
for attempts in one two three four;
  REMAINING=
  for file in $FILES; do
    echo
    echo "About to Retrieve $file from $SOU$SRDIR"
    echo "via $proxy"
    echo
    if ssh -x $proxy ftp "$SOU$SRDIR$file"; then
      echo " Retrieving file $file ..."
      scp -p $proxy:~/$file .
      chmod 666 $file
      ls -l $file
      ssh -x $proxy rm $file
    else
      echo "File transfer failed. Bummer. $err"
      echo "Trying again in 15 minutes"
      REMAINING="$REMAINING $file"
    fi
  done
  case $REMAINING in '') break;; esac
  FILES=$REMAINING
  sleep 900
done