Script loops again and again and again and ...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script loops again and again and again and ...
# 1  
Old 05-15-2012
Question 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.
Code:
#!/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

Smilie

Last edited by jim mcnamara; 05-15-2012 at 10:56 PM..
# 2  
Old 05-15-2012
No - the command is not looping it is asking if you want to get each file individually.
The ftp line should be
Code:
ftp -in $HOST << EOT

The -i option for ftp ignores (does not ask) for mget
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Looking to minimize 'for' loops in script

Hi, Below is the script that I came up with but looking to see if there is a more appropriate way to achieve this by reducing number of "for" loops or something. Regards, mbak #!/usr/bin/ksh status=missing for disk in `lspv | awk '{print $1}'` do MISSPATH=`lspath -l ${disk} -s... (3 Replies)
Discussion started by: mbak
3 Replies

2. Shell Programming and Scripting

Two for loops in ksh script only one not executing

Hello, I have two "for loops" in my script and the second one is not executing the way i want. Script: #!/bin/ksh IFS=' ' printf "Enter Account name: " read A B C D E F G H I J K L M N O for i in ${A} ${B} ${C} ${D} ${E} ${F} ${G} ${H} ${I} ${J} ${K} ${L} ${M} ${N} ${O};... (3 Replies)
Discussion started by: seekryts15
3 Replies

3. Shell Programming and Scripting

script for connecting database in loops

Hi experts. I have different database and schema and their passwords in one file. In Unix : I want to create the script that connect the sqlplus and execute the select query one by one schema with different database. Ex: password File Format databse schemaname password DB1 name1 ... (1 Reply)
Discussion started by: abhigrkist
1 Replies

4. Shell Programming and Scripting

help with multiple loops in shell script

Hi Guys- I'm trying to write a script which takes date as input (mm.yy.dd) and search in the current file. If pattern doesn't exist it will then look in a backup directory and so on. being a newb i'm unable to loop over to the backup directory. hoping for some ideas, i've highlighted the... (1 Reply)
Discussion started by: Irishboy24
1 Replies

5. Shell Programming and Scripting

multiple while loops in expect script

Hi, I am trying to incorporate multiple while loops into an expect script written in ksh shell. This is on a Solaris 10 system. Here is the code: #!/bin/ksh EXPECT=/usr/local/bin/expect exp_internal i=1 h=0 while ]; do $EXPECT << DONE set stty_init raw ... (1 Reply)
Discussion started by: cic
1 Replies

6. Shell Programming and Scripting

Expect script - going in loops can't stop

Hi First of all I tried lot of forums to create my first expect script. But I am totally stumped at the last step. I am no Linux Admin or ever trained in Linux. I just tried to create the script logically History : I need to to change my password across lot of servers in Linux over ssh ... (4 Replies)
Discussion started by: radioactive9
4 Replies

7. Homework & Coursework Questions

Shell-script loops beginner

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: "Create a shell script that changes the selected word to another word in all files from selected archive. The... (1 Reply)
Discussion started by: oibanuelos
1 Replies

8. Shell Programming and Scripting

Howto shorten script in a busybox environment by using for loops?

My satellite receiver is equipped with busybox, so a small linux version. That is why I can not use certain commands like #tomorrow in date commands or #date -d &quot;+1 day&quot; and thus I have to use: day1=$ I want to download every day 6 files from the internet but the filenames consist of the date... (6 Replies)
Discussion started by: ni_hao
6 Replies

9. Shell Programming and Scripting

Mailing script using loops

Hi all.. I'm not a scripter but I'm trying to set up a mail script that emails out once a file has been written to. Is there some way of writing a while read loop or something, so that it reads each line of the file and then ends when a specific number of lines have been written... We're... (2 Replies)
Discussion started by: Jazmania
2 Replies

10. Shell Programming and Scripting

Enhancing Script (using loops) to go through for each group

Currently I have written a shell script that will add departments for one group (displayed below with configuration file). I want to enhance the script in order to add departments to multiple groups by: 1. Making changes to allow the script to loop through and write each dept/group combo into... (0 Replies)
Discussion started by: dolo21taf
0 Replies
Login or Register to Ask a Question