On Donnerstag, 10. August 2017 22:26:44 CEST Dale R. Worley wrote:
> Tim Rühsen <tim.rueh...@gmx.de> writes:
> > wget -o/dev/null URL
> > 
> > You can check for errors via the $? (on Linux, there should be something
> > comparable on other systems).
> Yes, but since I'm running it in crontab, I really do want to have
> output if an error occurs.  Of course, I can rig that by testing $?, but
> I'd rather see something like grep's behavior, where there is output to
> stderr if and only if an error was detected.

There are many different types of errors, some of them might be expected (e.g. 
404 is an error for you, but in a different scenario it is expected and 200 is 
an error).

Anyways, one practical approach would be to use e.g. '-o/tmp/log' and print 
the last X lines on return status != 0.

wget -o/tmp/log URL || tail -3 /tmp/log

Regards, Tim

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to