EAGL
December 25, 2012, 4:44am
1
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.
#! /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:
real 0m0.052s
user 0m0.003s
sys 0m0.004s
Thanks
Best Regards
RudiC
December 25, 2012, 5:31am
2
You might be using the shell's builtin time which doesn't bother to respect redirections. Try running /usr/bin/time
instead.
EAGL
December 25, 2012, 5:41am
3
Actually i have tried it too but it gave time results as 0.0
/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
Including start time and end time variables may help you:
#! /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.