This is a huge annoyance.
Whilst in older wget
versions (even stated so in the man page) the whole error code functionality had never worked reliably, current wget
versions appear to have it working TOO reliably.
I have a cron
job that might be dubbed a sort of "poor man's RSS", set up for a blog that has no RSS option. I'd just poll it every 15 minutes for new pages to come.
(that is, when it's currently at random-blog.net/entry2147.html, and I have 2148 stored in a variable and built my crontab from it, I will get 404
s UNTIL the entry2148.html page exists. (which is usually the case in less than 20 hours)
BUT...
cron
tends to become a bit TOO verbose whenever wget
returns a "not found" (404) (exit code 8):
(CRON) error grandchild #98765 failed with error code 8
Well I know that, don't I?!
I know that page does not YET exist, but I do not need cron
to tell me that with every run!
I've scoured the net for answers but there was nowhere any idea how to suppress these unnecessary messages while keeping my syslog
tidy.
Unfortunately, there is no way to tell wget
to simply output a code 0
despite "failure" (well, except for hacking it)
Any ideas about this problem, anyone?
You could wrap the stuff inside a shell-script, that ignores the actual exit code and exits with a 0 return. It could look like:
#!/bin/sh
cd /home/me/mycrondir
wget -flags tralalala tweedledom 2>&1 >>/home/me/mycrondir/myerrorlog.log
exit 0
#Eof
If wget (or other binaries you need) is not in the $PATH (as provided by cron) you could add these at the top of this script, like
PATH=/opt/bin:$PATH; export PATH