crontab, wget and redirection

crontab, wget and redirection

am 13.09.2007 13:43:16 von Brendan

Hi there,

I've got a cron job that appends standard output to a log file:
00 4 * * * myscript.bash >> mylog.txt
and send its error output to mail, which I like.

However, myscript.bash also invokes wget:
/usr/bin/wget --timestamping --no-host-directories --no-verbose \
ftp://somemachine/get_atmos/Completed_reg.log

The problem is that the wget standard output ends up in my mail
instead of being redirected to my log file, and I want my mail to only
have the errors. How do I coerce wget to redirect its standard output
to mylog.txt?

Thanks.

Re: crontab, wget and redirection

am 13.09.2007 14:00:19 von Joachim Schmitz

"Brendan" schrieb im Newsbeitrag
news:1189683796.886547.242230@50g2000hsm.googlegroups.com...
> Hi there,
>
> I've got a cron job that appends standard output to a log file:
> 00 4 * * * myscript.bash >> mylog.txt
> and send its error output to mail, which I like.
>
> However, myscript.bash also invokes wget:
> /usr/bin/wget --timestamping --no-host-directories --no-verbose \
> ftp://somemachine/get_atmos/Completed_reg.log
>
> The problem is that the wget standard output ends up in my mail
> instead of being redirected to my log file, and I want my mail to only
> have the errors. How do I coerce wget to redirect its standard output
> to mylog.txt?
>
> Thanks.
>
/usr/bin/wget --timestamping --no-host-directories --no-verbose \
ftp://somemachine/get_atmos/Completed_reg.log 2>&1


Bye, Jojo

Re: crontab, wget and redirection

am 13.09.2007 14:23:35 von Brendan

On Sep 13, 9:00 am, "Joachim Schmitz"
wrote:
> /usr/bin/wget --timestamping --no-host-directories --no-verbose \
> ftp://somemachine/get_atmos/Completed_reg.log2>&1

But won't that simply send my error to standard out which will end up
sending both to mail through cron?

Re: crontab, wget and redirection

am 13.09.2007 14:47:03 von Brendan

Okay. Double checked wget man and it says it logs all messages to
standard error by default, so with addition of a space between g and
2, what JoJo gave should work.

Re: crontab, wget and redirection

am 13.09.2007 15:08:53 von Joachim Schmitz

"Brendan" schrieb im Newsbeitrag
news:1189687623.086456.56350@r29g2000hsg.googlegroups.com...
>
> Okay. Double checked wget man and it says it logs all messages to
> standard error by default, so with addition of a space between g and
> 2, what JoJo gave should work.
??? I had a space between g and 2

Bye, Jojo

Re: crontab, wget and redirection

am 13.09.2007 15:11:34 von Joachim Schmitz

"Brendan" schrieb im Newsbeitrag
news:1189686215.657078.159470@57g2000hsv.googlegroups.com...
> On Sep 13, 9:00 am, "Joachim Schmitz"
> wrote:
>> /usr/bin/wget --timestamping --no-host-directories --no-verbose \
>> ftp://somemachine/get_atmos/Completed_reg.log 2>&1
>
> But won't that simply send my error to standard out which will end up
> sending both to mail through cron?
Yes. But apparently wget writes it's output to stderr

Bye, Jojo