LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-13-2009, 02:46 PM   #1
klss
LQ Newbie
 
Registered: Oct 2008
Distribution: Mint
Posts: 22

Rep: Reputation: 15
Scripting: How to put wget in foreground?


Hi there.

I am using wget in a script for downloading stuff from sourceforge (http).

It seems to start in background, so that the script continues.
This makes the script fail.

How do I get wget in the forground? Or is there another solution to it.
Somehow downloads from ftp server do work.


THX
 
Old 01-13-2009, 02:58 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
nothing will fork unless you tell it to... maybe if you actually showed us your script you'd be able to get more help... with urls from sf.net and such, are there maybe some &'s in the url that you're not handling properly?
 
Old 01-13-2009, 03:00 PM   #3
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
Hi,

Try using the command wait. It should do the job.

I found the following link for an example on how to use it: link
 
Old 01-13-2009, 03:36 PM   #4
klss
LQ Newbie
 
Registered: Oct 2008
Distribution: Mint
Posts: 22

Original Poster
Rep: Reputation: 15
Hi.

This is the function I use in the script.

Code:
download () {
header "Download data"
cd $SOXSRCDIR
wget -nd -v http://downloads.sourceforge.net/sox/sox-14.2.0.tar.gz?modtime=1226179484&big_mirror=0  >>$LOG
tar -xvvf $SOXPACK >>$LOG
}
I also introduced background = off in /etc/wgetrc - NO change.


I'll checkout the "wait" hint. Even though I don't understand, why it is
not working.

THX so far.

Cheers
 
Old 01-13-2009, 03:50 PM   #5
klss
LQ Newbie
 
Registered: Oct 2008
Distribution: Mint
Posts: 22

Original Poster
Rep: Reputation: 15
"wait" did the trick.

THX a lot.
 
Old 01-13-2009, 03:52 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well wait isn't the right way to solve this at all... As i guessed, the & in the url is causing a fork, so everything after that is being treated as a new command, which will fail and give an error before moving on. if the url works with the & and everything past it removed, then remove it.
 
Old 01-13-2009, 04:35 PM   #7
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
... or put a single quote on either side of the URL.
 
Old 01-13-2009, 04:53 PM   #8
klss
LQ Newbie
 
Registered: Oct 2008
Distribution: Mint
Posts: 22

Original Poster
Rep: Reputation: 15
THX a lot folks. A real beginner problem.

When I look at it now - it seems to be more than obvious.

Cheers
 
  


Reply

Tags
bash



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scripting or maybe wget question babag Programming 9 01-31-2012 11:00 PM
Background and Foreground Datamike Linux - Software 2 01-20-2006 04:20 PM
Linux scripting - wget loop northy_ie Programming 7 11-09-2005 08:17 AM
wine not in foreground ? kron1234 Linux - Games 1 06-01-2005 03:37 PM
loading foreground nautilus_1987 Slackware 6 10-10-2002 01:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration