0

I am trying to get the response time of a server so for example I am using below curl command I got of the internet

curl -w "@curl-format.txt" -o /dev/null -s http://wordpress.$

The curl-format.txt looks like the following:

n
        time_namelookup:  %{time_namelookup}n
           time_connect:  %{time_connect}n
        time_appconnect:  %{time_appconnect}n
       time_pretransfer:  %{time_pretransfer}n
          time_redirect:  %{time_redirect}n
     time_starttransfer:  %{time_starttransfer}n
                        ----------n
             time_total:  %{time_total}n
n

This command works fine when called through the command line.

However when I try to use it in crontab and output the times to a file called Restime.text it does not work.

Below is the crontab command I am using.

* * * * * /usr/bin/curl -w "@curl-format.txt" -o /dev/null -s http://wordpress.$ >> /home/ubuntu/newApp/Restime.txt 

Any advice as to where I am going wrong ?

Kind Regards.

DugD
  • 1
  • Your commands appear to work fine on a system I have to hand. I suspect you need to capture stderr to see what's going on. The linked duplicate should help you solve your problem but it it doesn't it will help you gather information that will help us help you. – user9517 Mar 13 '17 at 13:44
  • Thank you for your reply, I have followed the link you have sent me and it has helped me. I changed the crontab command to * * * * * * /usr/bin/curl -w "/home/ubuntu/newApp/@curl-format.txt" -o /dev/null -s http://wordpress.$ >> /home/ubuntu/newApp/Restime.txt. I modified it so it has a path to the curl-format.txt file. However now in the ResTime.txt ouput file all it prints is "/home/ubuntu/newApp/@curl-format.txt" and not the response times – DugD Mar 13 '17 at 15:32

0 Answers0