FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Server Development

 
 
LinkBack Thread Tools
 
Old 10-26-2008, 06:09 PM
Michael Hipp
 
Default Can't redirect cron output

This worked fine on all my systems but stopped at Gutsy. Hardy and Intrepid
both have the problem also: cron output can't be redirected.

Here's what used to work:

# Fetch mail for michael
*/10 02-23 * * * michael fetchmail &> /dev/null

This is in the "system" cron at /etc/crontab.

I don't want to get an email if the fetchmail command fails; just be silent.
But now I'm getting an email every 10 minutes telling me "no mail for michael".
Dapper didn't do this. The redirection works fine when run from the command line.

How can I get redirection working again?

Thanks,
Michael

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 10-26-2008, 07:15 PM
Serge van Ginderachter
 
Default Can't redirect cron output

----- "Michael Hipp" <Michael@Hipp.com> wrote:

> # Fetch mail for michael
> */10 02-23 * * * michael fetchmail &> /dev/null

Shouldn't that line read as follows?

*/10 02-23 * * * michael fetchmail > /dev/null




Serge

Serge van Ginderachter http://www.vanginderachter.be/

Kreeg u een "odt" bestand en kan u deze niet openen? Zie http://ginsys.be/odf

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 10-26-2008, 07:27 PM
Michael Hipp
 
Default Can't redirect cron output

Serge van Ginderachter wrote:
> ----- "Michael Hipp" <Michael@Hipp.com> wrote:
>
>> # Fetch mail for michael
>> */10 02-23 * * * michael fetchmail &> /dev/null
>
> Shouldn't that line read as follows?
>
> */10 02-23 * * * michael fetchmail > /dev/null

Thanks. I'm trying to send both stdout and stderr to /dev/null.


http://www.gnu.org/software/bash/manual/bashref.html#Redirections
-------------------

3.6.4 Redirecting Standard Output and Standard Error

Bash allows both the standard output (file descriptor 1) and the standard error
output (file descriptor 2) to be redirected to the file whose name is the
expansion of word with this construct.

There are two formats for redirecting standard output and standard error:
&>word
and
>&word

Of the two forms, the first is preferred. This is semantically equivalent to
>word 2>&1
-------------------

I've been using this for some years with no problems until Gutsy.

What am I missing?

Thanks,
Michael

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 10-26-2008, 07:34 PM
"Dustin Kirkland"
 
Default Can't redirect cron output

On Sun, Oct 26, 2008 at 2:09 PM, Michael Hipp <Michael@hipp.com> wrote:
> This worked fine on all my systems but stopped at Gutsy. Hardy and Intrepid
> both have the problem also: cron output can't be redirected.
>
> Here's what used to work:
>
> # Fetch mail for michael
> */10 02-23 * * * michael fetchmail &> /dev/null

Try using:
fetchmail >/dev/null 2>&1

:-Dustin

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 10-26-2008, 08:50 PM
Onno Benschop
 
Default Can't redirect cron output

On 27/10/08 05:27, Michael Hipp wrote:
>
> I've been using this for some years with no problems until Gutsy.
>
> What am I missing?
>
>
Different shell? There was a transition from sh to dash

--
Onno Benschop

Connected via Optus B3 at S3154'06" - E11550'39" (Yokine, WA)
--
()/)/)() ..ASCII for Onno..
|>>? ..EBCDIC for Onno..
--- -. -. --- ..Morse for Onno..

ITmaze - ABN: 56 178 057 063 - ph: 04 1219 8888 - onno@itmaze.com.au



--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 10-26-2008, 09:02 PM
Michael Hipp
 
Default Can't redirect cron output

Dustin Kirkland wrote:
> On Sun, Oct 26, 2008 at 2:09 PM, Michael Hipp <Michael@hipp.com> wrote:
>> This worked fine on all my systems but stopped at Gutsy. Hardy and Intrepid
>> both have the problem also: cron output can't be redirected.
>>
>> Here's what used to work:
>>
>> # Fetch mail for michael
>> */10 02-23 * * * michael fetchmail &> /dev/null
>
> Try using:
> fetchmail >/dev/null 2>&1

Thank you. That seems to have quieted things down.

Michael

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 10-26-2008, 09:14 PM
Michael Hipp
 
Default Can't redirect cron output

Onno Benschop wrote:
> On 27/10/08 05:27, Michael Hipp wrote:
>> I've been using this for some years with no problems until Gutsy.
>>
>> What am I missing?
>>
>>
> Different shell? There was a transition from sh to dash

You're probably correct. I didn't realize dash would be the shell of choice for
things like cron. Now I notice that a user I just created was given 'sh' which
really means dash, and boy does it seem sparse.

Is there a big reason not to repoint /bin/sh to bash?

Michael




--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 10-26-2008, 09:28 PM
"Todd Deshane"
 
Default Can't redirect cron output

On Sun, Oct 26, 2008 at 6:14 PM, Michael Hipp <Michael@hipp.com> wrote:
> Onno Benschop wrote:
>> On 27/10/08 05:27, Michael Hipp wrote:
>>> I've been using this for some years with no problems until Gutsy.
>>>
>>> What am I missing?
>>>
>>>
>> Different shell? There was a transition from sh to dash
>
> You're probably correct. I didn't realize dash would be the shell of choice for
> things like cron. Now I notice that a user I just created was given 'sh' which
> really means dash, and boy does it seem sparse.
>
> Is there a big reason not to repoint /bin/sh to bash?
>

This explains the rationale in general:
https://wiki.ubuntu.com/DashAsBinSh

Cheers,
Todd


--
Todd Deshane
http://todddeshane.net
http://runningxen.com

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 10-26-2008, 10:16 PM
Daniel Pittman
 
Default Can't redirect cron output

Michael Hipp <Michael@Hipp.com> writes:

> This worked fine on all my systems but stopped at Gutsy. Hardy and
> Intrepid both have the problem also: cron output can't be redirected.
>
> Here's what used to work:
>
> # Fetch mail for michael
> */10 02-23 * * * michael fetchmail &> /dev/null
>
> This is in the "system" cron at /etc/crontab.
>
> I don't want to get an email if the fetchmail command fails; just be
> silent.

What you almost certainly want to solve your actual problem is:

*/10 ... fetchmail --silent

[...]

> How can I get redirection working again?

Others have already answered this.

Regards,
Daniel


--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 10-26-2008, 10:26 PM
Michael Hipp
 
Default Can't redirect cron output

Daniel Pittman wrote:
> Michael Hipp <Michael@Hipp.com> writes:
>
>> This worked fine on all my systems but stopped at Gutsy. Hardy and
>> Intrepid both have the problem also: cron output can't be redirected.
>>
>> Here's what used to work:
>>
>> # Fetch mail for michael
>> */10 02-23 * * * michael fetchmail &> /dev/null
>>
>> This is in the "system" cron at /etc/crontab.
>>
>> I don't want to get an email if the fetchmail command fails; just be
>> silent.
>
> What you almost certainly want to solve your actual problem is:
>
> */10 ... fetchmail --silent

Thanks. I didn't know of that option. Fetchmail is just one simple example of
my chattering crons. So the redirect answer was more versatile. :-)

Thanks,
Michael

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 

Thread Tools




All times are GMT. The time now is 05:11 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org