LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-08-2011, 12:10 PM   #1
fantasygoat
Member
 
Registered: Sep 2009
Posts: 119

Rep: Reputation: 17
Strange wget operation


I've got a quick and dirty script I use to determine how fast our web server is returning results, for both the base page and all the content as well.

I recently added redirects into the web server to 302 anyone using anything other than our main domain, but it broke my script, so I added a header option.

Quote:
#!/bin/sh

url=$1
full=$2

if [ "$full" = "full" ]; then
options="--header='Host: www.example.com' -p -q -nd --delete-after"
else
options="--header='Host: www.example.com' -q"
fi

output=`/usr/bin/time -f %e /usr/bin/wget $options -o /dev/null "$url" 2>&1`
msec=`echo "$output * 1000" | /usr/bin/bc | awk -F '.' '{ print $1 }'`

echo $msec
The problem now is that if I manually run the command being captured by the output variable, I get the correct run time, but if I run the script the value of output is completely different, almost random.

The script was working perfectly before I added the header part to compensate for the redirect, so there's something weird going on with wget.

Any clues?
 
Old 09-08-2011, 12:13 PM   #2
fantasygoat
Member
 
Registered: Sep 2009
Posts: 119

Original Poster
Rep: Reputation: 17
Nevermind. The single quotes were the problem - changing them makes it work as expected.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to resume an interrupted wget using wget.log? misterJ Linux - Software 2 06-19-2011 01:21 PM
Can ping but can't wget - strange network behavior donv2 Linux - Networking 1 04-29-2011 10:47 AM
strange wget behaviour. cant download beyond 2gb (Windoze) ciden General 7 10-18-2008 09:16 AM
wget not working! but "man wget is" ??? wrapster Solaris / OpenSolaris 5 07-30-2008 03:00 AM
strange, strange alsa problem: sound is grainy/pixellated? fenderman11111 Linux - Software 1 11-01-2004 05:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:26 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