1752815 Members
5851 Online
108789 Solutions
New Discussion юеВ

cron output question

 
iranzo
Frequent Advisor

cron output question

Hello,

Here is a part of my cron

00,15,30,45 * * * * /users/killproc

The script is ok
But when it's start the standard output go to root's mail .(lot of messages !!)

Start of script:
# Killproc
. /users/explara/env/exploit.env #env exploit
. /users/explara/env/cmxAP.env # env cimix
#
FOUT=/users/explara/log/killproc.log
exec 1>$FOUT 2>&1
#
...

Thanks.


Bonjour
3 REPLIES 3
Peter Kloetgen
Esteemed Contributor

Re: cron output question

Hi Malosse,

the standard output of cron is the mail account of the user, who started the job. If you don't want this, you have to redirect your output, for example into a logfile:

00,15 * * * * /usr/killproc > /path_to_logfile/logfile 2>/path_to_errorfile/errorlogfile

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Jdamian
Respected Contributor

Re: cron output question

You must to redirect the output of the script in crontab.
Otherwise, the standard output and error output is e-mailed to user.
Steven Sim Kok Leong
Honored Contributor

Re: cron output question

Hi,

If you don't want the output, redirect the STDOUT and STDERR to /dev/null in your cron job:

00,15,30,45 * * * * /users/killproc >/dev/null 2>&1

Hope this helps. Regards.

Steven Sim Kok Leong