Results 1 to 7 of 7
Hello people im needing a little help with a batch file.
I have a sh file that downloads some files from an ftp site.
wget -v -N --directory-prefix=/home/myname/mydownloaddirectory --random-wait --wait=120 ...
- 07-02-2007 #1Just Joined!
- Join Date
- Jun 2007
- Posts
- 13
bash problem
Hello people im needing a little help with a batch file.
I have a sh file that downloads some files from an ftp site.
wget -v -N --directory-prefix=/home/myname/mydownloaddirectory --random-wait --wait=120 --user=my username --password=my pass ftp://my ftp site/*.* &
cp /home/myname/mydownloaddirectory /home/myname
the problem that i have is that the copy command executes inmediately after the execution of the sh, it does not wait until i download all the files.
I need it to wait until the files have been downloaded.
Do you know how i can do this?. I can t use a wait statement because the sizes of the files may vary a lot.
Thanks a lot
- 07-02-2007 #2
The '&' at the end of the wget line means "Background this process". This means that the process will be executed, and then the script will immediately move on to the next command.
Remove that '&' and it should work.DISTRO=Arch
Registered Linux User #388732
- 07-02-2007 #3Just Joined!
- Join Date
- Jun 2007
- Posts
- 13
it works LIKE A CHARM!
Thanks pal!
Now the only problem i have is that the wget is not working in the background and i would like it to run in the background so it wont slow down all the other automatic tasks im running.
Do you know any other way to do it?
- 07-02-2007 #4
Use the -q option in wget
Put your hand in an oven for a minute and it will be like an hour, sit beside a beautiful woman for an hour and it will be like a minute, that is relativity. --Albert Einstein
Linux User #425940
Don't PM me with questions, instead post in the forums
- 07-02-2007 #5
I'm not sure what you mean. When we say that a process is backgrounded, we mean that it doesn't connect to that particular shell instance, and therefore the shell is free to go on to other tasks. Further, the shell's input stream is still available for other programs to use.
Juan Pablo's suggestion will prevent wget from printing anything out. If your concern is that wget will take up too much CPU power (though the concern probably isn't justified with wget), you can use the 'nice' command to change its priority. Run "man nice" to see how it works.DISTRO=Arch
Registered Linux User #388732
- 07-03-2007 #6Just Joined!
- Join Date
- Jun 2007
- Posts
- 13
iĺl try to explain (sorry for my english im spanish).
cabhan suggested to remove the & and he was right!. Now the shell executes the wget command and when its finished it copies the files from a folder to another.
Now the problem i have is that when the shell runs the wget does not run on the background any more.
Is background equal to use little cpu power?
thanks a lot for the help.
- 07-04-2007 #7
They dont make a great difference IMO, if you still want to be in the background, just use the -q option as I stated
Put your hand in an oven for a minute and it will be like an hour, sit beside a beautiful woman for an hour and it will be like a minute, that is relativity. --Albert Einstein
Linux User #425940
Don't PM me with questions, instead post in the forums


Reply With Quote