|
While Loop Logic
I would need to with making while loop logic working in shell program when I am new into the shell programing
1) I would need to try to get the file from the remote side ----need to try 15 mins apart for 4 times and terminate the program if file is not available....
I would need to know how I can setup counters to try in while loop ......
as I have sample at below. Please assist
==============================================
for file in $FILES; do
echo
echo "About to Retrieve $file from $SOU$SRDIR"
echo "via $proxy"
echo
err=1
while [ "$err" != 0 ]; 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
fi
done
echo " Retrieving file $file ..."
scp -p $proxy:~/$file .
chmod 666 $file
ls -l $file
ssh -x $proxy rm $file
done
==========================================
|