Script loops again and again and again and ...

Hi,

Linux newbie here with what I'm guessing is silly questions.

My script below is working in that it correctly copies files from the backup IP (10.0.91.1) back down to the Linux server but trouble is it loops continuously.

It correctly downloads 100 files from the the IP 10.0.91.1 then once complete starts downloading the same files again and again and again....

It's seems to be just the mget command that is looping.

#!/bin/bash
/home/backupst/grab2
HOST='10.0.91.1'
USER='uuuuuuu'
PASSWD='xxxxxx'
cd /home/backupst/public_html/daily
ftp -n -v  $HOST << EOT
user $USER $PASSWD
prompt
cd cpbackup/daily
mdelete notwanted.tar.gz
mget *
bye
EOT
exit 0
 

:wall:

No - the command is not looping it is asking if you want to get each file individually.
The ftp line should be

ftp -in $HOST << EOT

The -i option for ftp ignores (does not ask) for mget