[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] Errors-only mode
From: |
Tim Rühsen |
Subject: |
Re: [Bug-wget] Errors-only mode |
Date: |
Fri, 11 Aug 2017 13:20:42 +0200 |
User-agent: |
KMail/5.2.3 (Linux/4.11.0-2-amd64; KDE/5.28.0; x86_64; ; ) |
On Donnerstag, 10. August 2017 22:26:44 CEST Dale R. Worley wrote:
> Tim Rühsen <address@hidden> 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.
Example:
wget -o/tmp/log URL || tail -3 /tmp/log
Regards, Tim
signature.asc
Description: This is a digitally signed message part.