LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-10-2005, 03:10 PM   #1
bbeers
Member
 
Registered: Jul 2002
Location: Florida
Distribution: Centos, Slackware
Posts: 260

Rep: Reputation: 30
how to make cron not send email?


I use > /dev/null at the end of my crontab command,
but I see files clogging up my /var/spool/cron/,
and since I don't run sendmail, files also clogging up
my /var/spool/mqueue.

I saw some versions of cron use a file /etc/crontab where
one can set MAILTO="", does that work for dcron in
Slackware?

Thanks,
 
Old 11-10-2005, 04:07 PM   #2
Back_to_Linux
Member
 
Registered: Sep 2005
Location: PARIS
Distribution: Mandriva 10.0 Communoty
Posts: 117

Rep: Reputation: 15
configure your /etc/syslog.conf to inhibite the emailer
and add 1>/de/null 2>/dev/null at the end of command
 
Old 11-10-2005, 04:13 PM   #3
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
or
Code:
 2>&1
at the end of the command line
 
Old 11-10-2005, 04:36 PM   #4
Back_to_Linux
Member
 
Registered: Sep 2005
Location: PARIS
Distribution: Mandriva 10.0 Communoty
Posts: 117

Rep: Reputation: 15
i was afraid to make mistake about syntaxe, that why i show the "schooll" way.
 
Old 11-11-2005, 06:11 AM   #5
Nobber
Member
 
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265

Rep: Reputation: 30
I prefer

Code:
&> /dev/null
myself (for its brevity).
 
Old 11-11-2005, 09:48 AM   #6
bbeers
Member
 
Registered: Jul 2002
Location: Florida
Distribution: Centos, Slackware
Posts: 260

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by Nobber
I prefer

Code:
&> /dev/null
myself (for its brevity).
This I think is the solution. The crond was trying to send e-mails
when the script in my cronjob was not succeeding, thus producing
output to stderr. What I had in place,
Code:
 cmd > /dev/null
only redirected the stdout, preventing e-mails when the script
succeeded.

BTW, the following are equivalent and redirect both stdout (1) and
stderr (2) to /dev/null:
Code:
 cmd &> /dev/null
 cmd 1> /dev/null 2> /dev/null
Thank you all for your replies.

I suppose the answer to the second part of my original post:
Quote:
I saw some versions of cron use a file /etc/crontab where
one can set MAILTO="", does that work for dcron in
Slackware?
is no.
 
Old 11-11-2005, 09:59 AM   #7
bbeers
Member
 
Registered: Jul 2002
Location: Florida
Distribution: Centos, Slackware
Posts: 260

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by Back_to_Linux
configure your /etc/syslog.conf to inhibite the emailer
and add 1>/de/null 2>/dev/null at the end of command
I don't understand how implementing the first part of your recommendation
would have any effect. I don't have any emailer running. Are you saying I
should put something like
Code:
 mail.* /dev/null
in my /etc/syslog.conf?

The second part is, minus the typo of course, correct. Thanks.
 
Old 11-11-2005, 10:31 AM   #8
bbeers
Member
 
Registered: Jul 2002
Location: Florida
Distribution: Centos, Slackware
Posts: 260

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by keefaz
or
Code:
 2>&1
at the end of the command line
The first of these seems to work (try e.g. 'ls -xy' for cmd)
Code:
 cmd > /dev/null 2>&1 
 cmd 2>&1 > /dev/null
The latter does not, but neither is as clean as the other solution offered up:
Code:
 cmd &> /dev/null
Thanks,
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make a C program send email notification/alerts? eigenyeugen Programming 1 01-04-2005 08:16 PM
usin AWK in cron job to send dynamic ip via email digihlp Programming 2 12-10-2003 08:10 AM
Cron job , send email mikeshn Linux - General 1 09-21-2003 09:02 AM
Send Email + Txt Attachment Using Cron Job beringer Linux - Newbie 3 01-31-2003 10:23 AM
cron to run a an sql query and send Email ehsan Linux - General 2 03-14-2001 10:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration