redirecting output from "cron" command

redirecting output from "cron" command

Post by Sébastien FERRANDE » Fri, 29 Sep 2000 04:00:00



Every time I schedule a cron job I get a mail with "Output from "cron"
comman" as subject. How can I redirect the standard error output to
avoid being sent these e-mails  ? Do I have to send it to the null file
? I have csh.
 
 
 

redirecting output from "cron" command

Post by Martin Pau » Fri, 29 Sep 2000 04:00:00



> Every time I schedule a cron job I get a mail with "Output from "cron"
> comman" as subject. How can I redirect the standard error output to
> avoid being sent these e-mails  ? Do I have to send it to the null file ?

Add ">/dev/null 2>&1" to the end of the crontab entry.

Quote:> I have csh.

cron jobs are run by /bin/sh, so your login shell doesn't matter.

hth, mp.
--
                         Martin Paul | Systems Administrator

Liechtensteinstrasse 22, A-1090 Wien | Tel: 01 4277 38803
        http://www.par.univie.ac.at/ | Fax: 01 4277 9388

 
 
 

redirecting output from "cron" command

Post by Sébastien FERRANDE » Fri, 29 Sep 2000 04:00:00


Ok, thanks. If I get the point, >/dev/null 2>&1
means that you're redirecting the error output (2, isn't it ?) to /dev/null (&1
means the first argument, isn't it ?)


> > Every time I schedule a cron job I get a mail with "Output from "cron"
> > comman" as subject. How can I redirect the standard error output to
> > avoid being sent these e-mails  ? Do I have to send it to the null file ?

> Add ">/dev/null 2>&1" to the end of the crontab entry.

> > I have csh.

> cron jobs are run by /bin/sh, so your login shell doesn't matter.

> hth, mp.
> --
>                          Martin Paul | Systems Administrator

> Liechtensteinstrasse 22, A-1090 Wien | Tel: 01 4277 38803
>         http://www.par.univie.ac.at/ | Fax: 01 4277 9388

 
 
 

redirecting output from "cron" command

Post by Martin Pau » Fri, 29 Sep 2000 04:00:00



> Ok, thanks. If I get the point, >/dev/null 2>&1
> means that you're redirecting the error output (2, isn't it ?) to /dev/null (&1
> means the first argument, isn't it ?)

close, but not quite :)

the number is a file descriptor, where 1 stands for stdout, and
2 is stderr (error output).

Quote:>/dev/null (or 1>/dev/null) redirects everything that goes to stdout

do /dev/null, and 2>&1 redirects everything that goes to stderr to
where descriptor 1 (stdout) points.

hth, mp.
--
                         Martin Paul | Systems Administrator

Liechtensteinstrasse 22, A-1090 Wien | Tel: 01 4277 38803
        http://www.par.univie.ac.at/ | Fax: 01 4277 9388

 
 
 

redirecting output from "cron" command

Post by Peter Sundstro » Sat, 30 Sep 2000 04:00:00



>Ok, thanks. If I get the point, >/dev/null 2>&1
>means that you're redirecting the error output (2, isn't it ?) to /dev/null
(&1
>means the first argument, isn't it ?)

2>&1 means associate standard error (file desc 2) with standard out (file
desc 1).  It's a shorter way to write: command 1>/dev/null 2>/dev/null
 
 
 

1. can't redirect output of "time" command


This is the time output of the bash builtin

This is what a csh script (/usr/bin/which) finds as time (time is
not builtin in csh)

Maybe this is a special case for bash. I don't use it so I don't know.
To be sure you aren't using the (special handled?) internal time, you
should use "\":
\time some command

--
Daniel

2. SB AWE-32 and Linux

3. How to redirect outputs from the command "time" into a file?

4. Configuring SOCKS5

5. Gotta Love it!

6. : Weird ">" redirect behavior vs. ">>" redirect behavior

7. Minimal Setup for PPC machine

8. How to redirect the output of "time" command

9. Modify Cron mail subject from displaying "Output from Cron"

10. GETSERVBYNAME()????????????????????"""""""""""""

11. "write" "to" "flon" commands

12. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""