How to stop output from cron command

How to stop output from cron command

Post by Electr » Fri, 23 Mar 2001 06:46:45



Hi all,



Someone told me I have to use /dev/null.  What is the syntax?

Cron below:
10 1 * * * /usr/local/bin/somescript

Thanks
Electron

 
 
 

How to stop output from cron command

Post by Chuck Swige » Fri, 23 Mar 2001 05:02:21



Quote:> Cron below:
> 10 1 * * * /usr/local/bin/somescript

Try:

10 1 * * * /usr/local/bin/somescript > /dev/null 2>&1

-Chuck


       -------------+-------------------+-----------------------------------
       I believe that what I'm feeling changes how the world appears.  -Rush

 
 
 

How to stop output from cron command

Post by Nate Eldredg » Fri, 23 Mar 2001 05:36:33



> Hi all,



> Someone told me I have to use /dev/null.  What is the syntax?

> Cron below:
> 10 1 * * * /usr/local/bin/somescript

/usr/local/bin/somescript >/dev/null

which sends the job's standard output to /dev/null, which discards it.

This output might also go to standard error, in which case use (may
depend on your shell)

/usr/local/bin/somescript >&/dev/null

which directs both stdout and stderr to /dev/null.

--

Nate Eldredge

 
 
 

How to stop output from cron command

Post by Mark Hargrav » Fri, 23 Mar 2001 05:02:19


10 1 * * * /usr/local/bin/somescript >/dev/null 2>$1

Mark


> Hi all,



> Someone told me I have to use /dev/null.  What is the syntax?

> Cron below:
> 10 1 * * * /usr/local/bin/somescript

> Thanks
> Electron

--
Mark Hargrave  <><

Web:   http://www.markhargrave.com
"Depart from evil and do good; seek peace and pursue it" (Psalm 34:14)
 
 
 

How to stop output from cron command

Post by Roy » Fri, 23 Mar 2001 06:17:23




> Hi all,



> Someone told me I have to use /dev/null.  What is the syntax?

> Cron below:
> 10 1 * * * /usr/local/bin/somescript

> Thanks
> Electron

10 1 * * * /usr/local/bin/somescript > /dev/null 2>&1

redirect STDOUT and STDERR to /dev/null.

regards
roy

 
 
 

How to stop output from cron command

Post by Electr » Fri, 23 Mar 2001 08:35:34


Thank you all.

-- Electron



>Hi all,



>Someone told me I have to use /dev/null.  What is the syntax?

>Cron below:
>10 1 * * * /usr/local/bin/somescript

>Thanks
>Electron

 
 
 

How to stop output from cron command

Post by Barry Margoli » Fri, 23 Mar 2001 06:45:17




Quote:>This output might also go to standard error, in which case use (may
>depend on your shell)

No, it doesn't depend on your shell, cron always uses /bin/sh.

Quote:>/usr/local/bin/somescript >&/dev/null

>which directs both stdout and stderr to /dev/null.

See all the other responses for the correct syntax to redirect stderr.

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

How to stop output from cron command

Post by Tony Walto » Fri, 23 Mar 2001 20:53:46





> >This output might also go to standard error, in which case use (may
> >depend on your shell)

> No, it doesn't depend on your shell, cron always uses /bin/sh.

> >/usr/local/bin/somescript >&/dev/null

> >which directs both stdout and stderr to /dev/null.

> See all the other responses for the correct syntax to redirect stderr.

That's all the other responses except the one where there's a typo ("$"
instead of "&" )

:-)

--
Tony

 
 
 

How to stop output from cron command

Post by Mathew Kirsc » Fri, 23 Mar 2001 21:24:29



> Thank you all.

If your cron job fails, don't you want to know about it so you can fix
whatever caused it to fail?
 
 
 

How to stop output from cron command

Post by Electr » Sat, 24 Mar 2001 07:05:34


Hi Mathew,

Thanks for asking.  Most of the time I do but not on this one.  It is
an ftp script running every 10 minutes.

Thanks
--Alex

On Thu, 22 Mar 2001 07:24:29 -0500, Mathew Kirsch



>> Thank you all.

>If your cron job fails, don't you want to know about it so you can fix
>whatever caused it to fail?

 
 
 

How to stop output from cron command

Post by Avi Abram » Sun, 25 Mar 2001 06:45:35



> Hi all,



> Someone told me I have to use /dev/null.  What is the syntax?

> Cron below:
> 10 1 * * * /usr/local/bin/somescript

> Thanks
> Electron

Hi Electron,
I don't understand - someone told you to use /dev/null
but they couldn't tell you the syntax? Could you explain
that anomaly please? Anyway...

10 1 * * * /usr/local/bin/somescript > /dev/null 2>&1

will redirect all output (including error messages)
to the "file" /dev/null. This, of-course, means that
you will not see any output from your cron job - but
then again, that's what you asked for!

Perhaps the following "man" pages would be appropriate:

sh
crontab

Good Luck,
Avi.