[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: not mailing output of cronjobs



Mike Dresser <mdresser_l@windsormachine.com> [2002-09-12 13:39:38 -0400]:
> On 12 Sep 2002, Kenneth Macdonald Karlsen wrote:
> > I tried to read man but with no success.
> > How do i avoid to get a report by mail of a specific cronjob?
> > I run it hourly and I do not want to receive mail about it.
> 
> put a >/dev/null 2>&1 at the end of your crontab entry.

In any script that is intended to be run by cron, but sometimes also
interactively, I do this.  You might find it useful too.

  if [ ! -t 0 ]; then
    exec >/dev/null 2>&1
  fi

If the input is not a terminal then throw away the output.  This is
the case with cron.  But if the input is a terminal, such as when I am
running it interactively, then just let the output fly.

Bob

Attachment: pgpvvHz4tRF82.pgp
Description: PGP signature


Reply to: