Time outputs of wget command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Time outputs of wget command
# 1  
Old 12-25-2012
Time outputs of wget command

Hello friends,

I've been working on a solaris server,

I need to test responses of a web service using WGET command, if the response is successful, how quick it is etc.

I have scirpt like this, I modified it, i try to redirect the output of time command to total.txt but i couldn't manage, i would appreciate any help to correct it.

Code:
#! /bin/sh
NOW=`date +%c`;
NOW="\n############## $NOW ##############\n"
echo -e $NOW >> /tmp/total.xml;
time /usr/sfw/bin/wget  --timeout=30 --post-file=/tmp/soaprequest.xml --header="Content-Type: text/xml" --header="SOAPAction: \"getBalanceAndDate\""  http://10.X.X.X:8082/airprovisioningclient/ -O /tmp/response.xml >> /tmp/total.xml 2>&1
cat /tmp/response.xml >> /tmp/total.xml;

SOAP request response is redirected to response.xml and then to total.xml, and the normal wget output appended to total.xml file.

But not this output:
Code:
real 0m0.052s
user 0m0.003s
sys 0m0.004s

Thanks
Best Regards
# 2  
Old 12-25-2012
You might be using the shell's builtin time which doesn't bother to respect redirections. Try running /usr/bin/time instead.
# 3  
Old 12-25-2012
Actually i have tried it too but it gave time results as 0.0 :/

Code:
/usr/bin/time /usr/sfw/bin/wget --timeout=30 --post-file=/tmp/soaprequest.xml --header="Content-Type: text/xml" --header="SOAPAction: \"getBalanceAndDate\"" http://10.51.207.64:8082/ai
rprovisioningclient/ -O /tmp/response.xml > /tmp/resplog.txt 2>&1

real 0.0
user 0.0
sys 0.0

# 4  
Old 12-25-2012
Try with lower case -o.
# 5  
Old 12-25-2012
Including start time and end time variables may help you:

Code:
#! /bin/sh
NOW=`date +%c`;
NOW="\n############## $NOW ##############\n"
echo -e $NOW >> /tmp/total.xml;
start_time=$(date +%s)
time /usr/sfw/bin/wget  --timeout=30 --post-file=/tmp/soaprequest.xml --header="Content-Type: text/xml" --header="SOAPAction: \"getBalanceAndDate\""  http://10.X.X.X:8082/airprovisioningclient/ -O /tmp/response.xml >> /tmp/total.xml 2>&1
end_time=$(date +%s)

cat /tmp/response.xml >> /tmp/total.xml;

Compute the time differences here.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Wget takes a long time to complete

Hi, I wish to check the return value for wget $url. However, some urls are designed to take 45 minutes or more to return. All i need to check if the URL can be reached or not using wget. How can i get wget to return the value in a few seconds ? (8 Replies)
Discussion started by: mohtashims
8 Replies

2. Shell Programming and Scripting

awk giving different outputs each time

I have a strange issue. (awk '$3 == "nfs" { cnt++ }; END { print cnt }' /etc/fstab) This is giving different count each time. To test this, tried the one here -bash-3.2$ awk '/nfs/{print $2}' /etc/fstab | wc -l 151 -bash-3.2$ awk '/nfs/{print $2}' /etc/fstab | wc -l 145... (6 Replies)
Discussion started by: sureshmsi
6 Replies

3. Solaris

Reboot solaris box(What are all the command outputs)

Hi What are all the command outputs we have to note and keep it for safe before rebooting or shutting down a solaris box (5 Replies)
Discussion started by: newtoaixos
5 Replies

4. Shell Programming and Scripting

create outputs from other command outputs

hi friends, The code: i=1 while do filename=`/usr/bin/ls -l| awk '{ print $9}'` echo $filename>>summary.csv #Gives the name of the file stored at column 9 count=`wc -l $filename | awk '{print $1}'` echo $count>>summary.csv #Gives just the count of lines of file "filename" i=`expr... (1 Reply)
Discussion started by: rajsharma
1 Replies

5. Shell Programming and Scripting

How to store multiple outputs from an awk command?

x=`echo $line | awk -F "|" '{print $1;print NR}'` How will I get the 2 return values ($1 and NR) from awk to variables? (4 Replies)
Discussion started by: tene
4 Replies

6. Shell Programming and Scripting

Operating on each of the individual outputs of a command

ps -e -o pcpu,pid,cmd --sort pcpu | sed '/^ 0.0 /d'|awk '{print $2}'|grep -v PID Gives the output: 4482 4023 5912 I want to operate on each pid in the output. How to do so. (2 Replies)
Discussion started by: proactiveaditya
2 Replies

7. Shell Programming and Scripting

Grep/Awk WGet Time

I am trying to grep/awk how long it takes to get a page. I am trying to use the following command. time -p wget -q -O wget.tmp www.google.com 2>&1 | grep realThe problem is that my attempts to map stderr to stdout are being applied to wget not to time so all of the time output is displayed on... (2 Replies)
Discussion started by: wstrater
2 Replies

8. Shell Programming and Scripting

Assigning variable from command outputs to shell

First, this is bash (3.2.17), on a Mac, 10.5.7. What I'm trying to do is look at a list of users, and check to see if each exists. If they do, do some more stuff, if they don't, drop them into an error file. So, my user list is: foo - exists bar - does not exist blah - does not exist ... (2 Replies)
Discussion started by: staze
2 Replies

9. Shell Programming and Scripting

Trouble with tee command to capture script outputs

function GetInput { print -n "Input" read input export INPUT=$input } export COMMAND="GetInput" $COMMAND echo "$INPUT" $COMMAND | tee -a Log.log echo "$INPUT" The first one without "tee" works fine. echo "$INPUT" displays the values I type in for input. The second... (5 Replies)
Discussion started by: muthubharadwaj
5 Replies

10. Shell Programming and Scripting

recording command outputs in background

For example: % ls /store > list.txt % less list.txt % 1.txt % 2.txt I want to execute 'ls' in verbose and store the result in background to 'list.txt' so i dont have to execute another command just to view the contents of the 'list.txt' % ls /store > list.txt % 1.txt % 2.txt %... (2 Replies)
Discussion started by: jehrome_rando
2 Replies
Login or Register to Ask a Question