1752795 Members
5722 Online
108789 Solutions
New Discussion юеВ

Re: Curl Question

 
SOLVED
Go to solution
Allanm
Super Advisor

Curl Question


I am getting the following mail through a cron job with curl in it.

% Total % Received % Xferd Average Speed Time Curr.
Dload Upload Total Current Left Speed

0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
....

curl: (52) Empty reply from server

The script executes just fine but don't know why for few days I have started getting these emails with the curl progress report (meter) in it. I tested the script on the command line and the progress report doesnt show.

Any clues?

Thanks,
Allan
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor

Re: Curl Question

Hi Allan:

A return code of <52> means that the server didn't reply. If you wish, when you execute your script via a crontask, you could redirect STDERR to /dev/null. Remember, 'cron' has no terminal association and thus any unredirected STDOUT or STDERR is mailed to the initiating user.

#!/usr/bin/sh
[ -t 0 ] || exec 2>/dev/null
/usr/bin/curl ....

Regards!

...JRF...
Michal Kapalka (mikap)
Honored Contributor

Re: Curl Question

hi,

check this link there is a discussion about this issue.

link :
http://curl.haxx.se/mail/archive-2007-05/0021.html

mikap
Fabian Brise├▒o
Esteemed Contributor

Re: Curl Question

Hello.

what does this cron job do exactly ?
Knowledge is power.
Allanm
Super Advisor

Re: Curl Question


Thanks Folks,
Do u know why I get the progress report abt the curl in an email from cron but not on the terminal (if I do it from the command line).

Allan
James R. Ferguson
Acclaimed Contributor
Solution

Re: Curl Question

Hi (again) Allan:

From the 'curl' manpages:

/* begin quote */

cur normally displays a progress meter during operations, indicating the amount of transferred data, transfer speeds and estimated time left, etc.

However, since curl displays this data to the terminal by default, if you invoke curl to do an operation and it is about to write data to the terminal, it disables the progress meter as otherwise it would mess up
the output mixing progress meter and response data.

If you want a progress meter for HTTP POST or PUT requests, you need to redirect the response output to a file, using shell redirect (>), -o [file] or similar.

...

-s/--silent
Silent mode. Don├в t show progress meter or error messages. Makes Curl mute.

/* end quote */

Regards!

...JRF...


Allanm
Super Advisor

Re: Curl Question

Thanks JRF!

Regards,
Allan